submenu stay in DOM when main menu is destroyed

Hi !

Thank you for 5.3 :wink:

Note: i don’t use any static “id” in my webix app. Webix version: 5.3 PRO

In my app, i need to dynamicaly generate a menu (in fact, datatable context menu). So create it, show it and destroy it. This menu sometime include submenu(s).

It seem’s that submenu are not removed from the DOM tree when calling destructor()

https://snippet.webix.com/8qszj9td
Click the button to open the menu, then expand the first submenu, then click somewhere else to destroy the submenu. You will see that submenu stay in the DOM tree (main menu is removed as expected)

To avoid submenu staying in the DOM tree i made something like that:
https://snippet.webix.com/58px2zqf

Is it a little bug ? is there another best way to be sure that submenu will not stay in the DOM tree ?

Thank you

Note : same thing with 5.2 PRO

up

Hello,

Yep, I can confirm the bug, thank you for reporting.

Submenu should be destroyed together with the main menu. We will add a fix into the next version, but if you need it ASAP and have a support subscription, please contact support@webix.com.

For the time being, your workaround is ok.

I’ve got support subscription, but i’ll keep it for big bugs for which i can’t find a workaround myself.

My workaround is OK except if you need to play with getItem in menu/submenu, because calling destructor() destroy datastore(s). So i had to add delay/setTimeout before destructor(). But this case is not related to submenu staying in the DOM tree.

Thank you Helga for your response