/** * @private */Ext.define('Ext.grid.plugin.header.DropZone', { extend: 'Ext.grid.plugin.grouping.DropZone', columnCls: Ext.baseCSSPrefix + 'gridcolumn', panelCls: Ext.baseCSSPrefix + 'headercontainer', onDrop: function(info) { var data = info.data, column = data.column, sourceCol = column, source = data.sourcePanel, index = data.index, panel = this.panel; this.hideIndicators(); if (!panel) { return; } if (column.isGroupingPanelColumn) { column = column.getColumn(); } if (column.isGridColumn) { panel.insert(index, column); column.show(); } if (sourceCol.isGroupingPanelColumn) { // we need to destroy the grouping panel column after making it visible // in the grid header sourceCol.destroy(); source.notifyGroupChange(); } }, onDragMove: function(info) { var proxy = info.source.getProxy(); info.valid = this.accepts(info); if (proxy) { proxy.update(info); } this.callParent([info]); }, accepts: function(info) { var me = this, column = info.data.column, valid = true, el; if (!column) { return true; } el = me.getCursorElement(info, me.columnCls, me.columnSelector); if (el) { valid = !el.component.isGroupsColumn; } return valid && (column.isGroupingPanelColumn || column.isGridColumn); }, findNewIndex: function(overItem, pos, info) { var items = this.panel.getColumns(), index = items.indexOf(overItem), lastIndex = items.indexOf(info.data.column); if (overItem !== info.data.column && lastIndex >= 0) { if (lastIndex < index && pos === 'before') { index--; } else if (lastIndex > index && pos === 'after') { index++; } } return index; } });