PDA

View Full Version : Dynamic tab panel with a dynamic form or grid in each tab



r6174
17 Feb 2017, 12:29 AM
Hi
How can i add items (form/grids ) to dynamically added tabs in each tab as in example
http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/tabs/tab-scroller-menu.html

Thanks

Gary Schlosberg
17 Feb 2017, 6:23 AM
The tab panel doc page has an example of adding tabs:
http://docs.sencha.com/extjs/4.2.6/#!/api/Ext.tab.Panel-method-add

var tabs = Ext.create('Ext.tab.Panel', { items: [
{
title: 'Tab 1',
html : 'A simple tab'
},
{
title: 'Tab 2',
html : 'Another one'
}
],
renderTo : Ext.getBody()
});


Ext.create('Ext.button.Button', {
text : 'New tab',
scope : this,
handler : function() {
var tab = tabs.add({
// we use the tabs.items property to get the length of current items/tabs
title: 'Tab ' + (tabs.items.length + 1),
html : 'Another one'
});


tabs.setActiveTab(tab);
},
renderTo : Ext.getBody()
});