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!
Asked
Active
Viewed 1,276 times
1
-
possible duplicate of [GWT Cell Tree Right Click Selection](http://stackoverflow.com/questions/18599619/gwt-cell-tree-right-click-selection) – Philippe Gonday Nov 20 '14 at 14:51
-
1The linked question is not a duplicate. The OP wants a row-level event, not a cell-level. – Andrei Volgin Nov 20 '14 at 16:26
1 Answers
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