Why filterData() on a Menu does mute the addItemClickHandler() behavior?
-> It is a cast problem
Here is a how to handle this:
-> It is a cast problem
Here is a how to handle this:
Code:
grid.addRowContextClickHandler(new RowContextClickHandler() { public void onRowContextClick(RowContextClickEvent event) { final ListGrid listGrid = (ListGrid) event.getSource(); Criteria criteria = new Criteria(); for (ListGridRecord rec : listGrid.getSelection()) criteria.addCriteria("ID", rec.getAttribute("ID")); final Menu contextMenu = listGrid.getContextMenu(); contextMenu.filterData(criteria, new DSCallback() { public void execute(DSResponse response, Object rawData, DSRequest request) { Record[] data = response.getData(); MenuItem[] items = new MenuItem[data.length]; int i = 0; for (Record rec : data) items[i++] = (MenuItem) rec; contextMenu.setItems(items); } }); } });