Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to register function for an event control?

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

Tags:
Former Member replied

HI Bob


this._oSmartFilter.attachSearch(function(oEvent) { this.onMyMethod(oEvent).bind(this); });


should be

this._oSmartFilter.attachSearch(function(oEvent) { this.onMyMethod(oEvent); }.bind(this));

2 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question