1

我正在寻找处理单元格点击的方法。如果我以这种方式在网格中创建一个新列,该怎么做:

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

?

4

1 回答 1

1

您必须处理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
    }
});
于 2013-06-19T13:12:05.273 回答