+++ /dev/null
-/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.HeaderDragZone = function(grid, hd, hd2){\r
- this.grid = grid;\r
- this.view = grid.getView();\r
- this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
- Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);\r
- if(hd2){\r
- this.setHandleElId(Ext.id(hd));\r
- this.setOuterHandleElId(Ext.id(hd2));\r
- }\r
- this.scroll = false;\r
-};\r
-Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {\r
- maxDragWidth: 120,\r
- getDragData : function(e){\r
- var t = Ext.lib.Event.getTarget(e);\r
- var h = this.view.findHeaderCell(t);\r
- if(h){\r
- return {ddel: h.firstChild, header:h};\r
- }\r
- return false;\r
- },\r
-\r
- onInitDrag : function(e){\r
- this.view.headersDisabled = true;\r
- var clone = this.dragData.ddel.cloneNode(true);\r
- clone.id = Ext.id();\r
- clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";\r
- this.proxy.update(clone);\r
- return true;\r
- },\r
-\r
- afterValidDrop : function(){\r
- var v = this.view;\r
- setTimeout(function(){\r
- v.headersDisabled = false;\r
- }, 50);\r
- },\r
-\r
- afterInvalidDrop : function(){\r
- var v = this.view;\r
- setTimeout(function(){\r
- v.headersDisabled = false;\r
- }, 50);\r
- }\r
-});\r
-\r
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.HeaderDropZone = function(grid, hd, hd2){\r
- this.grid = grid;\r
- this.view = grid.getView();\r
- // split the proxies so they don't interfere with mouse events\r
- this.proxyTop = Ext.DomHelper.append(document.body, {\r
- cls:"col-move-top", html:" "\r
- }, true);\r
- this.proxyBottom = Ext.DomHelper.append(document.body, {\r
- cls:"col-move-bottom", html:" "\r
- }, true);\r
- this.proxyTop.hide = this.proxyBottom.hide = function(){\r
- this.setLeftTop(-100,-100);\r
- this.setStyle("visibility", "hidden");\r
- };\r
- this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
- // temporarily disabled\r
- //Ext.dd.ScrollManager.register(this.view.scroller.dom);\r
- Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);\r
-};\r
-Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {\r
- proxyOffsets : [-4, -9],\r
- fly: Ext.Element.fly,\r
-\r
- getTargetFromEvent : function(e){\r
- var t = Ext.lib.Event.getTarget(e);\r
- var cindex = this.view.findCellIndex(t);\r
- if(cindex !== false){\r
- return this.view.getHeaderCell(cindex);\r
- }\r
- },\r
-\r
- nextVisible : function(h){\r
- var v = this.view, cm = this.grid.colModel;\r
- h = h.nextSibling;\r
- while(h){\r
- if(!cm.isHidden(v.getCellIndex(h))){\r
- return h;\r
- }\r
- h = h.nextSibling;\r
- }\r
- return null;\r
- },\r
-\r
- prevVisible : function(h){\r
- var v = this.view, cm = this.grid.colModel;\r
- h = h.prevSibling;\r
- while(h){\r
- if(!cm.isHidden(v.getCellIndex(h))){\r
- return h;\r
- }\r
- h = h.prevSibling;\r
- }\r
- return null;\r
- },\r
-\r
- positionIndicator : function(h, n, e){\r
- var x = Ext.lib.Event.getPageX(e);\r
- var r = Ext.lib.Dom.getRegion(n.firstChild);\r
- var px, pt, py = r.top + this.proxyOffsets[1];\r
- if((r.right - x) <= (r.right-r.left)/2){\r
- px = r.right+this.view.borderWidth;\r
- pt = "after";\r
- }else{\r
- px = r.left;\r
- pt = "before";\r
- }\r
-\r
- if(this.grid.colModel.isFixed(this.view.getCellIndex(n))){\r
- return false;\r
- }\r
-\r
- px += this.proxyOffsets[0];\r
- this.proxyTop.setLeftTop(px, py);\r
- this.proxyTop.show();\r
- if(!this.bottomOffset){\r
- this.bottomOffset = this.view.mainHd.getHeight();\r
- }\r
- this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);\r
- this.proxyBottom.show();\r
- return pt;\r
- },\r
-\r
- onNodeEnter : function(n, dd, e, data){\r
- if(data.header != n){\r
- this.positionIndicator(data.header, n, e);\r
- }\r
- },\r
-\r
- onNodeOver : function(n, dd, e, data){\r
- var result = false;\r
- if(data.header != n){\r
- result = this.positionIndicator(data.header, n, e);\r
- }\r
- if(!result){\r
- this.proxyTop.hide();\r
- this.proxyBottom.hide();\r
- }\r
- return result ? this.dropAllowed : this.dropNotAllowed;\r
- },\r
-\r
- onNodeOut : function(n, dd, e, data){\r
- this.proxyTop.hide();\r
- this.proxyBottom.hide();\r
- },\r
-\r
- onNodeDrop : function(n, dd, e, data){\r
- var h = data.header;\r
- if(h != n){\r
- var cm = this.grid.colModel;\r
- var x = Ext.lib.Event.getPageX(e);\r
- var r = Ext.lib.Dom.getRegion(n.firstChild);\r
- var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";\r
- var oldIndex = this.view.getCellIndex(h);\r
- var newIndex = this.view.getCellIndex(n);\r
- if(pt == "after"){\r
- newIndex++;\r
- }\r
- if(oldIndex < newIndex){\r
- newIndex--;\r
- }\r
- cm.moveColumn(oldIndex, newIndex);\r
- return true;\r
- }\r
- return false;\r
- }\r
-});\r
-\r
-\r
-Ext.grid.GridView.ColumnDragZone = function(grid, hd){\r
- Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);\r
- this.proxy.el.addClass('x-grid3-col-dd');\r
-};\r
-\r
-Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {\r
- handleMouseDown : function(e){\r
-\r
- },\r
-\r
- callHandleMouseDown : function(e){\r
- Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);\r
- }\r
-});
\ No newline at end of file