1

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.

user3665549
  • 43
  • 1
  • 6

1 Answers1

2

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 

            }
        }
    });
Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58