source:
trunk/workshop-routing-foss4g/web/ext/src/widgets/grid/ColumnSplitDD.js
@
77
Revision 76, 2.1 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /*! |
2 | * Ext JS Library 3.4.0 |
3 | * Copyright(c) 2006-2011 Sencha Inc. |
4 | * licensing@sencha.com |
5 | * http://www.sencha.com/license |
6 | */ |
7 | // private |
8 | // This is a support class used internally by the Grid components |
9 | Ext.grid.SplitDragZone = Ext.extend(Ext.dd.DDProxy, { |
10 | fly: Ext.Element.fly, |
11 | |
12 | constructor : function(grid, hd, hd2){ |
13 | this.grid = grid; |
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 |
19 | }); |
20 | this.setHandleElId(Ext.id(hd)); |
21 | this.setOuterHandleElId(Ext.id(hd2)); |
22 | this.scroll = false; |
23 | }, |
24 | |
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); |
33 | this.minX = x - minw; |
34 | this.maxX = x + 1000; |
35 | this.startPos = x; |
36 | Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y); |
37 | }, |
38 | |
39 | |
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); |
45 | this.split = 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); |
49 | } |
50 | } |
51 | }, |
52 | |
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); |
58 | }, |
59 | |
60 | autoOffset : function(){ |
61 | this.setDelta(0,0); |
62 | } |
63 | }); |
Note: See TracBrowser
for help on using the repository browser.