Firstly, you should have defined an ID for a toolbar. Unless, there isn’t such view as $$(“toolbar”) in the app.
Secondly, when you replace one view with another one featuring the same ID - an error occurs and view looses this ID. It concerns replacing “navMenu” with “navMenu”. It could be solved by accessing the menu via the toolbar’s children array.
All in all, the replacement function looks like:
function updateMenuItems(menuItems) {
var menuConfig = createMenuConfig(menuItems,true);
webix.ui(menuConfig, $$('toolbar'), $$('toolbar').getChildViews()[2]);
}
just for pasterity here is the snippet showing update of the menu without replacing the view but redefining data property of config: http://webix.com/snippet/98a5d980