diff --git a/www/manager6/panel/ConfigPanel.js b/www/manager6/panel/ConfigPanel.js index 94f8fbec..d78cd152 100644 --- a/www/manager6/panel/ConfigPanel.js +++ b/www/manager6/panel/ConfigPanel.js @@ -87,6 +87,14 @@ Ext.define('PVE.panel.Config', { sp.set(stateid, { value: ntab }); } } + + // if we have a tabpanel which we declared lazy (with ptype: lazyitems) + // then we have the actual item in items.items[0] + // and there we need to fire the event hide + // because some tabs use this event (which is not fired in this case) + if (oldcard.plugins && oldcard.plugins[0] && oldcard.plugins[0].ptype == 'lazyitems') { + oldcard.items.items[0].fireEvent('hide'); + } } } }); diff --git a/www/manager6/panel/SubConfigPanel.js b/www/manager6/panel/SubConfigPanel.js index e0a76192..5aa83bdd 100644 --- a/www/manager6/panel/SubConfigPanel.js +++ b/www/manager6/panel/SubConfigPanel.js @@ -5,12 +5,16 @@ Ext.define('PVE.panel.SubConfig', { configPrefix: undefined, tabPosition: 'left', tabRotation: 0, + savedTab: undefined, getHState: function(itemId) { /*jslint confusion: true */ var me = this; if (!itemId) { + if (me.getActiveTab() === undefined) { + me.setActiveTab(0); + } itemId = me.getActiveTab().itemId; } @@ -42,16 +46,21 @@ Ext.define('PVE.panel.SubConfig', { if (state && state.value) { var res = hsregex.exec(state.value); if (res && res[1] && res[2] && res[1] === me.configPrefix) { - me.activeTab = res[2]; + me.activeTab = res[2]; // if we have lazy items, this does nothing + me.savedTab = res[2]; // so we save it here } } Ext.apply(me, { listeners: { afterrender: function(tp) { - var first = tp.items.get(0); - if (first) { - first.fireEvent('show', first); + // if we have lazy items, + // we saved the tabname in savedTab + if (me.activeTab === undefined && me.savedTab) { + me.setActiveTab(me.savedTab); + } else if (me.activeTab === undefined) { + // if we have nothing else, we set 0 as active + me.setActiveTab(0); } }, tabchange: function(tp, newcard, oldcard) {