How can we add click listener to activeitem in Tabbar, As i search I found that only event available is activeitemchange so the action will perform only if i click on another item and then on myitem
Asked
Active
Viewed 2,187 times
2
-
Please add your code and explain where exactly you want to put your tap/click listener and what do you want to do exactly. – Titouan de Bailleul Nov 01 '12 at 12:27
-
@veena may be this helps you. http://stackoverflow.com/questions/13178423/listener-to-tab-item-click-in-sencha – Vikal Sharma Nov 06 '12 at 13:02
2 Answers
1
Use the delegate
property when adding listeners to add a listener directly to the tab itself:
var tabPanel = Ext.Viewport.add({
xtype: 'tabpanel',
items: [
{
title: 'one',
html: 'one'
},
{
title: 'two',
html: 'two'
}
]
});
tabPanel.on({
delegate: 'tab',
tap: function(tab) {
console.log(tab.getText());
}
});

rdougan
- 7,217
- 2
- 34
- 63
0
Simpler:
add the button normally as it would be a tab... then, in tabpanel config element, add:
listeners: {
activeitemchange: function(source, value, oldValue, eOpts) {
if(value.id == 'chiama') {
// do actions...
// for example open a link:
// document.location = 'www.google.it';
source.setActiveItem(oldValue); //avoid tab switching
return false; // avoid tab switching
}
}
}

Marco Marsala
- 2,332
- 5
- 25
- 39