I want to add/remove a tab.
I am aware of add/remove methods. But my issue is that I want to re-add the same tab, again. The re-added tab is stored in memory. I want to be able to do something like this:
function addMyTab(tab) {
var me = this;
if (!tab) { // use most recently added tab
tab = me.tab;
} else { // update most recently added tab
me.tab = tab;
}
var tabPanel = Ext.ComponentQuery.query(..);
tabPanel.removeAll();
tabPanel.add(me.tab);
}
This however doesnot work, it throws this error:
Uncaught TypeError: Cannot read property 'addCls' of null
An Extjs forum thread suggest that this is due to trying to add an already destroyed element.
How can re-use the tab?
tab
here, and are you sure it is what you think it is at the time you calltabPanel.add
? – Chris Farmerremove
with theautoDestroy
param specifically set to false? Surely you're not really trying to re-add an actual Panel, because you wouldn't get that error if that were true, right? – Chris FarmerautoDestroy
tofalse
did the trick. Thanks! If you'd like to add an answer. – Isaac