2 * @class Ext.ux.TabReorderer
3 * @extends Ext.ux.BoxReorderer
4 * This plugin allow you to reorder tabs of a TabPanel.
6 Ext.define('Ext.ux.TabReorderer', {
8 extend: 'Ext.ux.BoxReorderer',
10 itemSelector: '.x-tab',
12 init: function(tabPanel) {
15 me.callParent([tabPanel.getTabBar()]);
17 // Ensure reorderable property is copied into dynamically added tabs
18 tabPanel.onAdd = Ext.Function.createSequence(tabPanel.onAdd, me.onAdd);
21 afterFirstLayout: function() {
27 this.callParent(arguments);
29 // Copy reorderable property from card into tab
30 for (tabs = this.container.items.items, len = tabs.length; i < len; i++) {
33 tab.reorderable = tab.card.reorderable;
38 onAdd: function(card, index) {
39 card.tab.reorderable = card.reorderable;
42 afterBoxReflow: function() {
45 // Cannot use callParent, this is not called in the scope of this plugin, but that of its Ext.dd.DD object
46 Ext.ux.BoxReorderer.prototype.afterBoxReflow.apply(me, arguments);
48 // Move the associated card to match the tab order
50 me.container.tabPanel.setActiveTab(me.dragCmp.card);
51 me.container.tabPanel.move(me.startIndex, me.curIndex);