eventsgwtcelltablecelllist

How to delegate event processing from CellList / CellTable to cell's widget in GWT?


Is there a way to process click event in cell's widget?

I implemented custom complex cell with text and image. Wrap it with FocusPanel and declare a click handler. But CellTable and CellList intercept all events.


Solution

  • There is a way of doing it directly, no wrapping:

        table.addCellPreviewHandler(new Handler<MyObject>() {
    
            @Override
            public void onCellPreview(CellPreviewEvent<MyObject> event) {
    
                if ("click".equals(event.getNativeEvent().getType())) {
    
                    // do something with a click, using event.getColumn(), 
                    // event.getIndex() and event.getValue() as necessary 
    
                }
            }
        });