Hybrid View

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member gevik's Avatar
    Join Date
    May 2009
    Location
    The Netharlands
    Posts
    265
    Vote Rating
    8
    gevik will become famous soon enough

      0  

    Exclamation [CLOSED]Ext.util.Event and fire bug?

    [CLOSED]Ext.util.Event and fire bug?


    The fire method in Ext.util.Event adds an additional object to the event arguments. Is this intended or a bug?

    Example:
    Code:
    new Ext.Button({
        text:'Hello World',
        renderTo:Ext.getBody(),
        listeners:{
            click:function(){
                    console.log(arguments);
            }
        }
    });
    In Ext3 you get 2 arguments:
    Code:
     [Object { initialConfig={...},  text="Hello World",  more...}, Object { browserEvent=,  button=0,  more...}]
    In Ext4 you get 3 arguments:
    Code:
     [Object { initialConfig={...},  text="Hello World",  more...}, Object { browserEvent=,  type="click",  more...}, Object {}]
    This is caused by ext-core-debug.js:12813:fire:
    Code:
                            if (listener.o) {
                                args.push(listener.o);
                            }

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    This is useful for passing on any data to the listeners. By adding it to the options object when you set up the listener, you can access them easily. Also it allows you to do specific behavior in your listeners based on the options you used to set them up (like buffer, delay etc).

  3. #3
    Ext JS Premium Member gevik's Avatar
    Join Date
    May 2009
    Location
    The Netharlands
    Posts
    265
    Vote Rating
    8
    gevik will become famous soon enough

      0  

    Default


    I see the benefit of passing the listener object to the handler function inside the same listener. Since the listener.o is added by default means that EVERY fireEvent call in the framework will have this extra argument. Unless this is carefully re-factored in the framework it will case hard to find bugs when using/slicing the javascript arguments variable.

    I noticed this because I have implemented a custom Ext.Direct provider for our Ext4Yii framework. The provider broke since the listener.o was not expected as an arguments item.

    I fixed it using array.pop() in our provider.

Similar Threads

  1. [CLOSED] GXT 1.1.2: DateField does not fire Change Event
    By firejack in forum Ext GWT: Bugs (1.x)
    Replies: 5
    Last Post: 23 Aug 2011, 3:38 AM
  2. Why is scope declared in Ext.util.Event fire() method?
    By andyatmiami in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 5 Jul 2009, 4:19 AM
  3. Fire event when a tab is closed
    By Esparry in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 2 Jul 2009, 6:50 AM
  4. Ext.util.Event.fire()
    By papasi in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 9 Mar 2007, 11:57 PM

Thread Participants: 1