Hello, I was just about to upgrade my project from 8 to lasted LTS version 14.
At start trying to add some context menus in my grid, I write this and the click listeners worked successfully.
GridContextMenu<Tenant> menu = grid.addContextMenu();
menu.addItem("a1111", e -> System.out.println("a1111"));
menu.addItem("a2222", e -> System.out.println("a2222"));
menu.addItem("a3333", e -> System.out.println("a3333"));
menu.addItem("a4444", e -> System.out.println("a4444"));
Then, because the menu status will be flow entity(one object item in grid) to changing. I write this
grid.addContextMenu().addGridContextMenuOpenedListener(event -> {
if (event.isOpened()) {
GridContextMenu<Tenant> menu = event.getSource();
menu.removeAll();
event.getItem().ifPresent(entity -> {
menu.addItem("a1111", e -> System.out.println("a1111" + entity));
menu.addItem("a2222", e -> System.out.println("a2222" + entity));
menu.addItem("a3333", e -> System.out.println("a3333" + entity));
menu.addItem("a4444", e -> System.out.println("a4444" + entity));
});
}
});
But the listener parts, such as System.out.println(…) cannot working when clicked that menu items whatever whats method for my tried, but no use. the console always black. Dose I wrong?
Thanks