flow-components
flow-components copied to clipboard
Select Grid row using context menu
In vaadin 7-8 we have the following functionality:
` myGrid.addContextClickListener(new ContextClickListener() {
@Override
public void contextClick(ContextClickEvent event) {
if (!(event instanceof GridContextClickEvent)) {
return;
}
GridContextClickEvent e = (GridContextClickEvent) event;
ContextMenu contextMenuView = new ContextMenu(myGrid, false);
MyModel file = (MyModel) e.getItemId();
fillMenu(contextMenuView, file, e.getItemId());
contextMenuView.open(event.getClientX(), event.getClientY());
});
` It is really good because i can select Grid Row item before context menu open. In current version i can't do it using Java. I think it would be a great improvement.
Any workaround for this? How to select grid item before opening context menu and have the context menu be created for that item? Could be possible like this...
setDynamicContentHandler(node -> {
removeAll();
grid.deselectAll();
grid.select(node);
createContextMenu(Set.of(node));
}
... but as long as a previous context menu is open the UI does not seem to get properly updated and still shows the previous context menu entries.
I have the same problems where i want to expand grid tree items in the main UI from a dialog. As long as the dialog is still open, internally the tree grid is expanded, but not shown in UI. If i close the dialog while doing the expansion, the UI is properly updated.