on 10-26-2015 3:21 PM
Hey there,
I'm looking for a way to subscribe a function for a specific events of a control.
In my scenario there is provided the method attachSearch() for the control FilterBar that attaches event handler fnFunction
to the 'search' event. But strangely enough while I'm calling this method by following line just calls my onMyMethod directly.
this._oSmartFilter.attachSearch(this.onMyMethod(oEvent));
After raising the event "search" the following error is returned:
Uncaught TypeError: Cannot read property 'call' of undefined
Any ideas?
Thanks for your help in advance.
Robert
Hi Robert,
Please correct, if my understanding is wrong.
Is this what you're expecting?
var that = this;
this._oSmartFilter.attachSearch(function(oEvent){
that.onMyMethod(oEvent);
});
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Dennis,
After trying yours, I do get followng console message:
Uncaught TypeError: this.onMyMethod is not a function
Strangely underneath where I did call your code I declared my method but this is not found . On the whole it looks as follows:
init: function(oEvent, aServiceOrders) {
this._oSmartFilter.attachSearch(function(oEvent) { this.onMyMethod(oEvent).bind(this); });
}
onMyMethod: function(oEvent, aServiceOrders) {
}
Hello Robert,
Want you need to do is just pass the function that you want to be called rather than execute it directly.
this._oSmartFilter.attachSearch(this.onMyMethod); is the proper way to do it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.