Referencing

Hello all,

I’m trying to open and close a tree widget inside a JetView (TypeScript) by clicking on buttons, but I don’t seem to understand how to reference the tree from the click action. My code:
https://snippet.webix.com/xytot9nt

I get a compile error that says: “TS2339: Property ‘openAll’ does not exist on type ‘baseview’.”

Thanks for any help.

OK, I found a way that works:
https://snippet.webix.com/fffv8fth

Still unsure. Is this the recommended way to do it? Or is there a better approach?

Thank you!

Please check Code Snippet

The approach which you are using is the correct one. There is a shorthand notation for the same task though.

Instead of

private getTree = () => this.getRoot().queryView({localId: "myTree"});
...
this.getTree().openAll();

you can use

this.$$("myTree").openAll();