Error after rebuilding menu

Hi,
I am building menu dynamically.
After rebuilding menu I am getting error of none unique id.
See snippet: http://webix.com/snippet/a90af3dd
The snippet does not show the error you need to place code in stand alone page.

Thank you

Thank you. I was under wrong impression that elem.empty() is enough.

Hi,

The elem.empty() removes HTML content but it doesn’t really destroy Webix component object in it.

Still, you can make use of component destructor function - it will destroy an object instance and remove HTML.

 function updateMenu(menuItems) {
          if($$("navMenu")) $$('navMenu').destructor();
          var configMenuItems = createMenuItems(menuItems);
          ..
}