3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
15 // This is a support class used internally by the Grid components
16 Ext.grid.SplitDragZone = function(grid, hd, hd2){
18 this.view = grid.getView();
19 this.proxy = this.view.resizeProxy;
20 Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
21 "gridSplitters" + this.grid.getGridEl().id, {
22 dragElId : Ext.id(this.proxy.dom), resizeFrame:false
24 this.setHandleElId(Ext.id(hd));
25 this.setOuterHandleElId(Ext.id(hd2));
28 Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
31 b4StartDrag : function(x, y){
32 this.view.headersDisabled = true;
33 this.proxy.setHeight(this.view.mainWrap.getHeight());
34 var w = this.cm.getColumnWidth(this.cellIndex);
35 var minw = Math.max(w-this.grid.minColumnWidth, 0);
36 this.resetConstraints();
37 this.setXConstraint(minw, 1000);
38 this.setYConstraint(0, 0);
42 Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
46 handleMouseDown : function(e){
47 var ev = Ext.EventObject.setEvent(e);
48 var t = this.fly(ev.getTarget());
49 if(t.hasClass("x-grid-split")){
50 this.cellIndex = this.view.getCellIndex(t.dom);
52 this.cm = this.grid.colModel;
53 if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
54 Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
59 endDrag : function(e){
60 this.view.headersDisabled = false;
61 var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
62 var diff = endX - this.startPos;
63 this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
66 autoOffset : function(){