Hi,
I need to reload menu for removing or add som menuItem when I click on a button, I have try with addMenuItem and removeMenuItem but this don’t work.
So how can I perform this operation ?
Best regards
Hi,
I need to reload menu for removing or add som menuItem when I click on a button, I have try with addMenuItem and removeMenuItem but this don’t work.
So how can I perform this operation ?
Best regards
May be not best but working solution for any screen controller:
@Autowired
private Screens screens;
@Subscribe("addMenuItemBtn")
public void onAddMenuItemBtnClick(Button.ClickEvent event) {
SideMenu sideMenu = (SideMenu) screens.getOpenedScreens().getRootScreen().getWindow().getComponent("sideMenu");
String menuItemId = RandomStringUtils.randomAlphabetic(3);
SideMenu.MenuItem rootItem = sideMenu.createMenuItem(menuItemId, String.format("Menu Item %s", menuItemId));
sideMenu.addMenuItem(rootItem, 0);
}
Thanks for your answer, I have found a solution
App.getInstance().createTopLevelWindow(AppUI.getCurrent());
this code reload the mainTopScreen wich contain the menu
Hi Alexandre
And how did you remove a menu item since it wasn’t working?
After hour of search I found a solution :
userSubstitutionManager.substituteUser(currentUserSubstitution.getEffectiveUser().getUsername());
App.getInstance().createTopLevelWindow(AppUI.getCurrent());
I reload sur Substitute User then I reload the menu