How can I get the active tab index in tab panel?

user386430 picture user386430 · Oct 14, 2015 · Viewed 11k times · Source

How can I get the active or selected tab index in tab panel in sencha touch?

I am using tabpanel in my application.

Answer

Mohit Saxena picture Mohit Saxena · Oct 15, 2015
var tabpanel = Ext.ComponentQuery.query('mainViewport #mainTabPanel'); //use your item Id / reference here
var activeTab = tabpanel.getActiveTab();
var activeTabIndex = tabpanel.items.indexOf(activeTab);