]>
git.proxmox.com Git - extjs.git/blob - extjs/packages/ux/classic/src/TabReorderer.js
2 * This plugin allow you to reorder tabs of a TabPanel.
4 Ext
.define('Ext.ux.TabReorderer', {
6 extend
: 'Ext.ux.BoxReorderer',
7 alias
: 'plugin.tabreorderer',
9 itemSelector
: '.' + Ext
.baseCSSPrefix
+ 'tab',
11 init: function(tabPanel
) {
14 me
.callParent([tabPanel
.getTabBar()]);
16 // Ensure reorderable property is copied into dynamically added tabs
17 tabPanel
.onAdd
= Ext
.Function
.createSequence(tabPanel
.onAdd
, me
.onAdd
);
20 onBoxReady: function() {
26 this.callParent(arguments
);
28 // Copy reorderable property from card into tab
29 for (tabs
= this.container
.items
.items
, len
= tabs
.length
; i
< len
; i
++) {
32 tab
.reorderable
= tab
.card
.reorderable
;
37 onAdd: function(card
, index
) {
38 card
.tab
.reorderable
= card
.reorderable
;
41 afterBoxReflow: function() {
44 // Cannot use callParent, this is not called in the scope of this plugin, but that of its Ext.dd.DD object
45 Ext
.ux
.BoxReorderer
.prototype.afterBoxReflow
.apply(me
, arguments
);
47 // Move the associated card to match the tab order
49 me
.container
.tabPanel
.setActiveTab(me
.dragCmp
.card
);
50 me
.container
.tabPanel
.move(me
.dragCmp
.card
, me
.curIndex
);