When I use remove method in tabpanel:
this.tabPanel.remove(tab);
It set setActive tab in last. I would like to set on previous. Now can I do this?
You can handle the event beforeremove to get the index of the removed tab and set the previous one.
var tabs = Ext.create('Ext.tab.Panel', {
items: [{
title: 'Tab 1',
html: 'A simple tab',
closable: true
}, {
title: 'Tab 2',
closable: true,
html: 'Another one'
}, {
title: 'Tab 3',
closable: true,
html: 'Another one'
}],
renderTo: Ext.getBody()
});
tabs.on('beforeremove', function(tabs, tab) {
var idx = tabs.items.indexOf(tab) - 1;
setTimeout(function() {
tabs.setActiveTab(idx);
}, 350);
});
You can check the working example.