PDA

View Full Version : How to set position of new created tab



luke82
12 Dec 2012, 4:45 AM
Hi, when I dynamically add new tabs into tab panel, can I define (set) a position? For example: I have created 3 tabs and I need add new tab on the second position. I couldn't find any solution. Thank you for reply. L.

evant
12 Dec 2012, 4:57 AM
Use the insert method: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.container.AbstractContainer-method-insert

luke82
12 Dec 2012, 5:26 AM
Thank you for reply. I'm using standard .ADD like this:




tabPanel.add([{
xtype : 'panelTest',
title: 'title test',
closable: true,
border : false,
itemId: 'tabPanelTest',
region : 'center',
layout : {
type : 'border'
}
}]);
tabPanel.setActiveTab('tabPanelTest');



Just I need set an index of position. Do you have any example? Thank you.

luke82
12 Dec 2012, 5:54 AM
Thank you. I got it. For me works:




tabPanel.insert(1, [{
xtype : 'panelTest',
title: 'title test',
closable: true,
border : false,
itemId: 'tabPanelTest',
region : 'center',
layout : {
type : 'border'
}
}]);
tabPanel.setActiveTab('tabPanelTest');