View Full Version : Extjs 4.2 Tab Panel don't change the TabPanel style of the tabs on setActiveTab()

22 Apr 2013, 7:05 PM
One problem that i have is that the state of the tab panel is never recover, i mean, the active tab is not recover on refresh of the web site, but all my other stateful components works just fine.

I didn't find the problem with that so i try a workaround

a function to get the active tab index:

var tabpanel = Ext.getCmp("editcardwindowtabpanel");
var activeTab = tabpanel.getActiveTab();
var activeTabIndex = tabpanel.items.findIndex('id', activeTab.id);
return activeTabIndex == undefined ? 0 : activeTabIndex;

then, this is the coinfig of the tabpanel:

xtype : 'tabpanel',
id : 'editcardwindowtabpanel',
stateId : 'editcardwindowtabpanel',
stateful : true,
stateEvents: ['tabchange'],
return {
activeTab: win.getActiveTabIndex()

I did that way so that if i have some mistake doing the stateful functionality i would be easy to fix.

so i did this on the controller:

'editcardwindow #editcardwindowtabpanel': {
afterrender: function(tabPanel, options) {
var savedActiveTabIndex = tabPanel.getState()["activeTab"];

It shows to me the Tab that was last open, but the layout of the eyelash (i'm not shure if that is the name of the top of the tabs) it shows open the first one

24 Apr 2013, 7:44 AM
I don't believe there are any walk-throughs on setting up your own custom state management on the Sencha site. You might look at the window component's source and see how it adds state events and uses the getState and applyState methods to recall the window's last saved state.