1

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!

Trisha
  • 63
  • 7

1 Answers1

4

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

});
Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
  • I have minimum knowledge on GWT. Could you please elaborate how can I add values to the list that should be populated when I click the right click. I am looking for something like contextmenu on a row click. – Trisha Nov 20 '14 at 16:50
  • You can show your own popup panel or something on the right click, and then act based on a user selection. But I cannot answer your question about adding values (which values?) to a list (which list?) without knowing more about your requirements. It probably deserves a separate question. – Andrei Volgin Nov 20 '14 at 16:55
  • I am trying to create a dropdown panel on the right click on the row. The Dropdown is like a context menu which will have a few fields: Create , Delete, Submit etc. I am using MenuBar options = new MenuBar(); options.addItem("Create", gwtPop); options.addItem("Submit", gwtPop); – Trisha Nov 20 '14 at 16:59