webix-jet icon indicating copy to clipboard operation
webix-jet copied to clipboard

Function ui and getRoot

Open sasemykin opened this issue 3 years ago • 1 comments

Hi! I am using TypeScript and WebixJet. You cannot pass new MyWindowsView (this.app, “”, myParams) to the this.ui (), I use // @ ts-ignore And TS swears at this.getRoot (). QueryView () - queryView does not exist on type IBaseView

sasemykin avatar Nov 17 '21 15:11 sasemykin

Hi!

  1. The second parameter - name - is obsotele and was removed about 2 years ago. So it's new MyWindowsView(this.app, myParams) now.

As for passing new SomeView(this.app, config) to this.ui - yes, it is a bit weird, since createView (called in ui) accepts the same parameter as any, and ui itself - as IBaseConfig | IJetViewFactory, which is incompatible with IJetView. For now, passing it as any makes TS lint happy:

this.Win = this.ui(new SomePopup(this.app, {}) as any);
  1. Yes, IBaseView does not contain all methods of Webix views. However, Webix itself has definitions for each specific widget. So to call Webix view methods, you should specify exact widget type, e.g.:
(this.getRoot() as webix.ui.layout).queryView("menu");

You can read about this in a blog post.

kullias avatar Nov 17 '21 16:11 kullias