3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
8 // This is a support class used internally by the Grid components
9 Ext.grid.SplitDragZone = Ext.extend(Ext.dd.DDProxy, {
12 constructor : function(grid, hd, hd2){
14 this.view = grid.getView();
15 this.proxy = this.view.resizeProxy;
16 Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
17 "gridSplitters" + this.grid.getGridEl().id, {
18 dragElId : Ext.id(this.proxy.dom), resizeFrame:false
20 this.setHandleElId(Ext.id(hd));
21 this.setOuterHandleElId(Ext.id(hd2));
25 b4StartDrag : function(x, y){
26 this.view.headersDisabled = true;
27 this.proxy.setHeight(this.view.mainWrap.getHeight());
28 var w = this.cm.getColumnWidth(this.cellIndex);
29 var minw = Math.max(w-this.grid.minColumnWidth, 0);
30 this.resetConstraints();
31 this.setXConstraint(minw, 1000);
32 this.setYConstraint(0, 0);
36 Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
40 handleMouseDown : function(e){
41 var ev = Ext.EventObject.setEvent(e);
42 var t = this.fly(ev.getTarget());
43 if(t.hasClass("x-grid-split")){
44 this.cellIndex = this.view.getCellIndex(t.dom);
46 this.cm = this.grid.colModel;
47 if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
48 Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
53 endDrag : function(e){
54 this.view.headersDisabled = false;
55 var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
56 var diff = endX - this.startPos;
57 this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
60 autoOffset : function(){