How can I get the active or selected tab index in tab panel in sencha touch?
I am using tabpanel
in my application.
How can I get the active or selected tab index in tab panel in sencha touch?
I am using tabpanel
in my application.
var tabpanel = Ext.ComponentQuery.query('mainViewport #mainTabPanel'); //use your item Id / reference here
var activeTab = tabpanel.getActiveTab();
var activeTabIndex = tabpanel.items.indexOf(activeTab);
I had to use:
tabpanel.getActiveItem();
Was getting this error on getActiveTab:
getActiveTab is not a function
var activeTab = tabPanel.getActiveTab();
var currentStep = tabPanel.items.indexOf(activeTab);
This is correct code:
getTabIndex: function(tab) {
var index = 0;
tab.up('#mainTabPanel').getItems().each(function(item) {
if (tab === item) {
return false;
}
if (item.tab) {
index++;
}
});
return index;
}
© 2022 - 2024 — McMap. All rights reserved.