How to create a Right click drop down menu for GWT cell table

1.3k views Asked by At

I have a cell table in GWT. I need to create a Right click on the rows in the Cell table. I have tried various methods but it isn't working. Can someone please help!

1

There are 1 answers

3
Andrei Volgin On BEST ANSWER

You can do something like this:

myTable.addCellPreviewHandler(new Handler<MyObject>() {

    @Override
    public void onCellPreview(CellPreviewEvent<MyObject> event) {
        if (event.getNativeEvent().getButton() == NativeEvent.BUTTON_RIGHT) {
            event.getNativeEvent().stopPropagation();
            // do something instead with myObject (event.getValue()) or
            // with this row (event.getIndex())
        }
    }

});