1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    131
    Vote Rating
    0
    MoShAn480 is on a distinguished road

      0  

    Default tab activate event help

    tab activate event help


    Hi,

    I am having some trouble understanding how events work in Ext. I have the following code:

    var id = 123;
    dialogTabs.getTab(tabId).addListener('activate',activateRequestTab);

    what is the parameters being passed to my "activateRequestTab" function? I would like to pass the "id" parameter to the function so every time I swicth tabs, i can carry out updates, and other related tasks, related to the id.

    Thanks.

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,506
    Vote Rating
    373
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    You can use:

    Code:
    var id = 123;
    dialogTabs.getTab(tabId).addListener('activate',activateRequestTab.createDelegate(scope, [id]));
    scope depends on the context you want to run activateRequestTab in. Can be this, tab, window, or else

    If you need to preserve original argument (which is tab index) use:
    Code:
    dialogTabs.getTab(tabId).addListener('activate',activateRequestTab.createDelegate(scope, [id], true));

  3. #3
    Ext User
    Join Date
    Sep 2008
    Location
    Alentejo, Portugal
    Posts
    26
    Vote Rating
    0
    karma is on a distinguished road

      0  

    Default


    Although I'm using Ext2.2, I thought it was a good idea to reuse this topic.

    I have a more primary doubt/bug than the first described here. Excerpt of my code:

    Code:
    tpanel = new Ext.TabPanel(
                    {
                        height: 600,
                        width: 950,
                        deferredRender: false,
                        defaults: { closable: true },   //tabs only
                        tbar: [
                          ....
                        ]
                         ,
                        listeners: {
                            activate: function(panel) {
                                alert('here!');
                            }
                        }
    
                    });
    
    
                    tpanel.render('filegrid');
    That 'alert' on event 'activate' never fires, although I switch,close and open multiple tabs. Any hint ?


    Thanks in advance
    Last edited by karma; 10 Sep 2008 at 9:28 AM. Reason: version information

Thread Participants: 2