I used routing method with this.show() which creates a new subview.
How can I call function of my subview.
You want to navigate to subview and call its method after that?
this.show("./some", { target: name }).then( _ => {
this.getSubView(name).callSome();
})
Please update to latest version of webix jet if above doesn’t work for you ( in some older versions this.show doesn’t provide a correct promise )
Also, check the code which you are using, most probably instead of external call, you can move the necessary logic in init
method of subview
this.show("./some?id=123")
//inside of SomeView
init(){
const id = this.getParam("id");
if (id){
this.$$("data").load( model.getInfo(id) );
}
}
I have a combo in my parent view, and whenever i change combo value, I want to call someFunction of my subView.
the way with “target: name” did not work for me.
Instead, i could call my subviews function with this below:
this._subs.default.view.someFunction();
the method above is calling my subViews function. Is it the right way to use it?
this._subs.default
must be equal to this.getSubView()
Also, in your case you still can write code without direct view interactions.
In combo
{ view:"combo", on:{
onChange: (value) => this.app.trigger("MasterChange", value)
})
in sub view
init(){
this.app.on("MasterChange", value => this.doSome(value));
}
Oh, shit. I could only use this.getSubView() without any params. Ive tought that i have to pass name or id of my subView in order to use getSubView(someParameter).
Thanks a lot.