Skip to Content

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.


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.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 26, 2015 at 03:36 PM

    Hi Robert,

    Please correct, if my understanding is wrong.

    Is this what you're expecting?

    var that = this;


    Sai Vellanki.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2015 at 03:55 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Hey Deyan,

      That's not point! The problem with your approach is that the onMyMethod method is not found by simply calling it through attachSearch.

      Anyhow, thanks for your reply...