Skip to content

Instantly share code, notes, and snippets.

@jhickman
Created April 8, 2014 17:08
Show Gist options
  • Save jhickman/10157240 to your computer and use it in GitHub Desktop.
Save jhickman/10157240 to your computer and use it in GitHub Desktop.
Grid Context Menu
final Grid<Stock> grid = new Grid<Stock>(store, cm) {
@Override
protected void onRightClick(Event event) {
EventTarget eventTarget = event.getEventTarget();
List<Stock> selectedItems = getSelectionModel().getSelectedItems();
boolean onSelectedRow = false;
for (Stock selectedItem : selectedItems) {
int index = store.indexOf(selectedItem);
Element selectedRow = getView().getRow(index);
if (selectedRow.isOrHasChild(XElement.as(eventTarget))) {
onSelectedRow = true;
break;
}
}
if (onSelectedRow) {
super.onRightClick(event);
}
}
};
@64BitAsura
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment