Hello,
I’m having some troubles using the MenuItems of the AppLayout.
Basically it is working fine. I can add AppLayoutMenuItem components to the menu of the AppLayout. And the basic routing is working.
At default the Menu should highlight the route you are currently on. This is not working. For example: If I am clicking on the “Login” Tab of the menu, the Login View shows up, but no Tab is highlighted. (You see the Menu reloading / or rebuilding) When I click on the “Login” Tab when I am already on the LoginView the menu now highlights “Login”.
Also: If I reload a page using the F5 key, I get the error “Assertion error: No child node found with id -1”
I think I am using the AppLayout wrong. I think it shouldn’t be recreated everytime I load a page.
LoginView.java:
@Route("login")
public class LoginView extends VerticalLayout {
public LoginView(@Autowired MessageBean bean) {
add(UiSupport.getAppLayout());
...
}
}
UiSupport.java:
public class UiSupport {
...
public static AppLayout getAppLayout(){
AppLayout appLayout = new AppLayout();
AppLayoutMenu menu = appLayout.createMenu();
...
menu.addMenuItems(
new AppLayoutMenuItem("Dashboard", "dashboard"),
new AppLayoutMenuItem("Login", "login")
);
...
return appLayout;
}
}