Add and remove subitems of sidebar

Hi,

Can’t manage to edit dynamically a sidebar, here is my code :
https://snippet.webix.com/a7xyz6hv

When clicking on the button (right), a subitem should be added to searchs.
When clicking on a subitem of searchs, subitem should be removed.

Sidebar use treetable, right ?
Guess I am using wrong id, I mean, these elements have an id number, in addition to their declared id ?

Thanks for helping :slight_smile:

Good day @Jean_Louis ,

Yes, a sidebar is based on a tree view. However, it is more related to its expanded state. When collapsed, it is only partly a tree that shows the first level of data, the other data levels are in a popup with a menu. So, depending on the state the sidebar has a different structure. And when you add or remove items to or from the expanded sidebar, you will need to reflect the changes in the menu also.

You can get the menu via sidebar.getPopup().queryView({view:"menu"});

Then, after adding (and removing) an item to the tree, you could serialize the data, clear the tree and parse the updated data so that it will be shown in the menu also.
When removing, the items should be removed both from the sidebar tree and the sidebar menu.

Have a look at the example: Code Snippet .