Dispose All Webix Components

Hello,

The website I am working on is built using technologies other than Webix. However, it has a new dashboard area which is using Webix. When a user navigates to that area, Webix is initialized using webix.ready().

When the user navigates away from the area of the site that is using Webix, we would like to dispose/destruct all Webix components and remove any HTML they have added. I have tried calling destruct() on the top most element but there is a lot of other HTML that sticks around.

Is there a way to accomplish this? Apologies if it is documented somewhere, I haven’t been able to locate it.

Hello @aklein,
The whole collection of currently created views is stored in webix.ui.views.
For destroying all views you can do like next:

for (let key of Object.keys(webix.ui.views)) {
if (webix.ui.views[key] && webix.ui.views[key].destructor) {
webix.ui.views[key].destructor();
}}

Please, check:
https://snippet.webix.com/cxa96nws

Thank you this is exactly what I was looking for and solved my problem.