I’m creating some custom components to use on my application.
They suffer from the same issue. When I create a instance within a window and then I close this window, all the other components from the same type that are out of this window, lost its events and other properties. If I hide the window, everything keeps working, but I’ll suffer from memory leak after several windows.
I don’t think simply hide the window full of components would be the best practice. Of course it depends the size of your application. But a application with several windows/components would generate a huge memory demand after some time using it.
And I may be doing something wrong on the creating of custom components. I’m just trying to find the better way to do it
Maybe… We use windows mainly for forms, and the idea was to avoid creating widgets which has already been created : for speed … and it maybe goes less heavy on the GC ? ( I have no number to prove that, though )
So far, the memory consumption seems stable.
Anyway, it is also possible that your current problem is a webix bug…
Let’s explore the problem from the very beginning.
When you define options for the combo box (richselect, etc.) a suggest list is created, which is basically a popup with an option list inside. Placing its initialization into defaults makes Webix creating one and the same list for several times.
So, you have three lists with the same id. If you coded under the debug version of Webix (webix_debug.js), you could see a warning message (Not unique ID). Snippet tool uses webix.js so this message is ignored.
Then you close the window. This action destroys the window itself and all the components inside it and all the popups related to these components. So, all the popups are destroyed because they have the same ID. Hiding, on the contrary, doesn’t presuppose destruction, it’s just setting display to none.
After clicking on other combos a warning message (Unknown popup) shows up. Indeed, a popup has been destroyed together with the window.
That’s the theory. In practice, if you initialize an empty popup and later populate it with select options, you will have three independent suggest lists, each of which relates to its own combo box.
P.s. Though it’s not a good practice - you’ll have lots of same popups in the app, it solves the problem with destruction. In other situations suggest sharing is preferred: http://webix.com/snippet/060a435e