27 |
jpm |
1 |
/*
|
|
|
2 |
* Ext JS Library 2.0.2
|
|
|
3 |
* Copyright(c) 2006-2008, Ext JS, LLC.
|
|
|
4 |
* licensing@extjs.com
|
|
|
5 |
*
|
|
|
6 |
* http://extjs.com/license
|
|
|
7 |
*/
|
|
|
8 |
|
|
|
9 |
// private
|
|
|
10 |
// This is a support class used internally by the Grid components
|
|
|
11 |
Ext.grid.SplitDragZone = function(grid, hd, hd2){
|
|
|
12 |
this.grid = grid;
|
|
|
13 |
this.view = grid.getView();
|
|
|
14 |
this.proxy = this.view.resizeProxy;
|
|
|
15 |
Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
|
|
|
16 |
"gridSplitters" + this.grid.getGridEl().id, {
|
|
|
17 |
dragElId : Ext.id(this.proxy.dom), resizeFrame:false
|
|
|
18 |
});
|
|
|
19 |
this.setHandleElId(Ext.id(hd));
|
|
|
20 |
this.setOuterHandleElId(Ext.id(hd2));
|
|
|
21 |
this.scroll = false;
|
|
|
22 |
};
|
|
|
23 |
Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
|
|
|
24 |
fly: Ext.Element.fly,
|
|
|
25 |
|
|
|
26 |
b4StartDrag : function(x, y){
|
|
|
27 |
this.view.headersDisabled = true;
|
|
|
28 |
this.proxy.setHeight(this.view.mainWrap.getHeight());
|
|
|
29 |
var w = this.cm.getColumnWidth(this.cellIndex);
|
|
|
30 |
var minw = Math.max(w-this.grid.minColumnWidth, 0);
|
|
|
31 |
this.resetConstraints();
|
|
|
32 |
this.setXConstraint(minw, 1000);
|
|
|
33 |
this.setYConstraint(0, 0);
|
|
|
34 |
this.minX = x - minw;
|
|
|
35 |
this.maxX = x + 1000;
|
|
|
36 |
this.startPos = x;
|
|
|
37 |
Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
|
|
|
38 |
},
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
handleMouseDown : function(e){
|
|
|
42 |
ev = Ext.EventObject.setEvent(e);
|
|
|
43 |
var t = this.fly(ev.getTarget());
|
|
|
44 |
if(t.hasClass("x-grid-split")){
|
|
|
45 |
this.cellIndex = this.view.getCellIndex(t.dom);
|
|
|
46 |
this.split = t.dom;
|
|
|
47 |
this.cm = this.grid.colModel;
|
|
|
48 |
if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
|
|
|
49 |
Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
},
|
|
|
53 |
|
|
|
54 |
endDrag : function(e){
|
|
|
55 |
this.view.headersDisabled = false;
|
|
|
56 |
var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
|
|
|
57 |
var diff = endX - this.startPos;
|
|
|
58 |
this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
|
|
|
59 |
},
|
|
|
60 |
|
|
|
61 |
autoOffset : function(){
|
|
|
62 |
this.setDelta(0,0);
|
|
|
63 |
}
|
|
|
64 |
});
|