WebixJet this.ui vs webix.ui

Hello Webix team!

I’ve seen the next note about this.ui method in JetView API doc:

this.ui() call is equivalent to webix.ui(). It creates a new instance of the view passed to it as a parameter. For example, you can create views inside popups or modal windows with this.ui(). The good thing about this way is that it correctly destroys the window or popup when its parent view is destroyed.

Does it mean that I should use this.ui instead of webix.ui everywhere it’s possible for memory leack/stolen widget prevention?

Thank you in advance!

Hi,

Yep, it is advised to usethis.ui with Jet applications. Windows created in such a way get destroyed together with the related JetView, which prevents from memory leaks. If you use webix.ui, you must destroy the widgets manually:

init(){
  this.win = webix.ui(config);
}
destroy(){
  this.win.close();
}

Same things is about event handlers. It is better to attach handlers in Jet manner: this.on(view, "onItemClick", handler) rather than view.attachEvent, otherwise you will have to detach events manually.

@Helga
Thank you very much for your answer!