Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Dec 2007
    Posts
    23
    Vote Rating
    0
    kyr0 is on a distinguished road

      0  

    Default [CLOSED-EXTJSIV-202] Attempted to bind an event listener to a function that...

    [CLOSED-EXTJSIV-202] Attempted to bind an event listener to a function that...


    Hi,

    there is a timing issue in Ext Core when it comes to add listeners.
    It's a common behaviour to have listener functions that become available
    to the interpreter at a time AFTER addListener() is called.

    It only counts for script execution that the event listener function is
    available at the time, the listener needs to be executed.

    But sadly, addListener checks for the availability of the listener function
    at the time the listener is registered for an event. This produces execptions
    in all cases written above: "uncaught exception: Ext.util.Event: Attempted
    to bind an event listener to a function that does not exist.";

    For my understanding this check can be removed.
    1. It doesnt help you detect where the missing event listener is at definition time.
    The exception provides no additional info!
    2. An exception will be fired in any way - if it's checked at definition time or not
    3. I don't think users will do:

    try {
    me.addListener(...);
    } catch(e) {...}

    Do you?

    Regards,

  2. #2
    Sencha User Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469
    Vote Rating
    14
    Jacky Nguyen has a spectacular aura about Jacky Nguyen has a spectacular aura about

      0  

    Default


    Ext.util.Event#addListener needs a valid function callback as the first argument, which makes perfect sense. Could you describe a use case when an event listener needs to be attached when the callback function is not available yet?
    Sencha Touch Lead Architect

  3. #3
    Sencha User Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469
    Vote Rating
    14
    Jacky Nguyen has a spectacular aura about Jacky Nguyen has a spectacular aura about

      0  

    Default


    The error message has been made clearer, you should now see something like this:

    Code:
    [{COMPONENT_CLASS_NAME}#addListener -> Ext.util.Event#addListener] Invalid callback function: {GIVEN_ARGUMENT}
    For example:

    Code:
    [Ext.button.Button#addListener -> Ext.util.Event#addListener] Invalid callback function: 'something'
    You can then simply use the Call Stack feature of Chrome / Safari Developer Tools or Firefox Firebug to hunt down the violated invocation
    Sencha Touch Lead Architect

Similar Threads

  1. Equivalent to Prototype bind() function?
    By jep in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 13 Nov 2010, 11:34 PM
  2. Replies: 2
    Last Post: 14 Jun 2010, 12:13 AM
  3. function bind this
    By sofway in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 27 Feb 2010, 1:59 PM
  4. GridView bind function optimization
    By para in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 21 Aug 2007, 9:30 AM
  5. [Ext 2.0] GridView bind function gone
    By JorisA in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 12 Aug 2007, 10:27 AM

Thread Participants: 1