我正在寻找处理单元格点击的方法。如果我以这种方式在网格中创建一个新列,该怎么做:
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
}
});