如何处理GXT 2.2网格中单元格的点击?

问题描述:

我正在寻找处理单元格单击的方式。如果我以这种方式在网格中创建新列,请执行此操作:如何处理GXT 2.2网格中单元格的点击?

column = new ColumnConfig(); 
column.setId("remove"); 
column.setHeader("Remove"); 
column.setWidth(100);   
configs.add(column); 

您必须处理ColumnConfig所属网格上的单元格单击。 例如,假设你有Grid grid = new Grid(new ColumnModel(column));,则:

grid.addListener(Events.CellDoubleClick, new Listener<GridEvent>() { 
    public void handleEvent(GridEvent be) { 
     // be.getColIndex() gets the index of the column clicked on. 
     // if you know the index of `column`, you can compare that number to the colIndex 
     // if the numbers are equal, do whatever you want to do 
     // see docs for GridEvent at 
     // http://dev.sencha.com/deploy/gxt-2.2.5/docs/api/com/extjs/gxt/ui/client/event/GridEvent.html 
    } 
}); 
+2

而对于经常点击,添加一个'Events.CellClick'听众。 –

+0

正确 - 在我的答案中,我打算放置'CellClick',但复制错误的事件名称。 :) –

+0

@thy_stack_overfloweth我面临类似的问题可以请看看,并提出解决方案这里是我的问题http://*.com/q/22610705/3277781 – Gundamaiah