source: trunk/web/addons/job_monarch/lib/extjs-30/src/widgets/grid/ColumnSplitDD.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

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