PDA

View Full Version : How to identify tab switch in a tab panel



Eugene Krivopaltsev
7 Dec 2010, 5:29 PM
Folks,

I have created a tabPanel like this:
mainPanel = new Ext.TabPanel({
fullscreen: true,
cardSwitchAnimation: 'cube',
layout: {
type: 'card'
},
defaults: {
cls: 'card',
},
items : [
comp1,
comp2,
comp3

],
tabBar: {
dock: 'bottom',
scroll: {
direction: 'horizontal',
useIndicators: false
},
layout: {
pack: 'left'
},
listeners: {
change: onMainCardSwitch,
cardswitch: onSwitch,
activate: onActivate
}
}


});

I found that only "cjhange" listener does work. When I try to getActiveItem from a tab.getTabBar().getActiveItem() it is not equal to neither comp1, comp2, comp3.

There is a simple method setActiveItem (int) why there is no correspondent get method.

Thanks,

--eugene

tomalex0
7 Dec 2010, 8:21 PM
Try


mainPanel = new Ext.TabPanel({
fullscreen: true,
cardSwitchAnimation: 'cube',
layout: {
type: 'card'
},
defaults: {
cls: 'card',
},
items : [
comp1,
comp2,
comp3

],
tabBar: {
dock: 'bottom',
scroll: {
direction: 'horizontal',
useIndicators: false,
listeners: {
change:function(tabbar,tab,card){
}
}
},
layout: {
pack: 'left'
},
listeners: {
change: onMainCardSwitch,
cardswitch: onSwitch,
activate: onActivate
}
}


});