简体   繁体   中英

How to handle the click on the cell in the GXT 2.2 grid?

I'm looking for the way to handle the cell click. How to do this if I create a new column in grid in this way:

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

?

You have to handle cell clicks on the grid to which the ColumnConfig belongs. For example, say you have Grid grid = new Grid(new ColumnModel(column)); , then:

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
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM