View Full Version : Tab Panel: Add/Destory Tabs (50 at least)

3 May 2014, 7:03 AM

I would like to know the best practice in this usecase:

1. There will be only 1 Tab Panel:
2. Tabs will be added at will (through menu buttons).
3. There will be 50++ unique tabs. All are closeable.

My question:
1. If I destroy a tab during runtime, is there a way to re-create it once again?

2. I tried to create a tab widget for all 50++ tabs and add them to the tab panel as follows:

var mainPanel = Ext.getCmp('mainTabPanel');
var productListTab = Ext.widget('ProductListTab');
console.log('The tab is ' + Ext.getCmp('mainTabPanel').getActiveTab().title);

1. When the tab is added as the second in the tabPanel, it is not set as Active... (no error in console).
2. In the above, the "ProductListTab" is the itemId identified inside the widget. Does widget inherit id and itemID defined inside it, or do I need to assign a new one?

19 May 2014, 8:05 AM
Instead of setting the child tab as active, you should have the tabpanel set the tab active:


As for the recreating it, you would have to cache the config when you destroy a tab and recreate it later. Ext does not do this at all.