1. #1
    Ext JS Premium Member
    Join Date
    Jan 2011
    Location
    Austin, TX
    Posts
    112
    Vote Rating
    0
    zillabyte is on a distinguished road

      0  

    Default Implementing Custom Events

    Implementing Custom Events


    Can someone provide me some insight or resources on how to implement custom events? I've used the Feed-viewer application as a model and in one instance the events work fine but in another class I have they don't work at all. Basically, I have a top level event that I'm trying to call using "this.fireevent". The class that DOES work is essentially at the same level as my targeted event but it's in another class.

    The class that DOES NOT work is embedded two levels down in another container so I figure that this is the problem. Somehow I need to get the events to "bubble up" to the main application class.

  2. #2
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,338
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    You can enable bubbling a couple ways:

    Code:
        Ext.define('...', {
            bubbleEvents: ['event1', 'event2']
        });
    or:

    Code:
        Ext.define('...', {
            constructor: function () {
                this.enableBubble(['event1', 'event2']);
            }
        });
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2011
    Location
    Austin, TX
    Posts
    112
    Vote Rating
    0
    zillabyte is on a distinguished road

      0  

    Default


    thanks for the reply. So, do I need to create this code in both:

    * the class that is doing the calling
    * any parent containers the calling class resides in

    I'm thinking that since the target method is say at the top level (Level 1) and the component that is firing the event is actually contained several levels down that this bubbling needs to take place at all levels.

    For example:

    ViewPort
    -> Panel0 (target event)
    -> Panel1->Panel2->TabPanel (firing event)

    So, in this scenario I would need to put the code you suggested in TabPanel, Panel2, then Panel1?

    Does this make sense?

  4. #4
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,338
    Vote Rating
    132
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    The bubble flag is part of the event definition and is only added to the component that calls addEvents on that event. A bubbled event will bubble up through other components regardless of whether or not they are expecting it.

    This can be risky, so chose the names of bubbled events wisely! You are essentially saying with a bubbled event that it is a global event name and such events could interact with any container.
    Don Griffin
    Ext JS Development Team Lead

    Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue

    "Use the source, Luke!"

  5. #5
    Ext JS Premium Member
    Join Date
    Jan 2011
    Location
    Austin, TX
    Posts
    112
    Vote Rating
    0
    zillabyte is on a distinguished road

      0  

    Default


    Okay, this is good info. I'll test this out. Thanks again for the help.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi