webix-hub / webix-jet

Webix Jet micro framework for Webix UI
67 stars 19 forks source link

Function ui and getRoot #43

Closed sasemykin closed 2 years ago

sasemykin commented 3 years ago

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

kullias commented 3 years ago

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);

2) 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.