PDA

View Full Version : tab activate event help



MoShAn480
26 Apr 2007, 2:08 PM
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.

jsakalos
26 Apr 2007, 5:26 PM
You can use:



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:


dialogTabs.getTab(tabId).addListener('activate',activateRequestTab.createDelegate(scope, [id], true));

karma
10 Sep 2008, 3:27 AM
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:


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