source: trunk/web/addons/job_monarch/lib/extjs/examples/grid/PanelResizer.js @ 619

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

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.6 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9Ext.ux.PanelResizer = Ext.extend(Ext.util.Observable, {
10    minHeight: 0,
11    maxHeight:10000000,
12
13    constructor: function(config){
14        Ext.apply(this, config);
15        this.events = {};
16        Ext.ux.PanelResizer.superclass.constructor.call(this, config);
17    },
18
19    init : function(p){
20        this.panel = p;
21
22        if(this.panel.elements.indexOf('footer')==-1){
23            p.elements += ',footer';
24        }
25        p.on('render', this.onRender, this);
26    },
27
28    onRender : function(p){
29        this.handle = p.footer.createChild({cls:'x-panel-resize'});
30
31        this.tracker = new Ext.dd.DragTracker({
32            onStart: this.onDragStart.createDelegate(this),
33            onDrag: this.onDrag.createDelegate(this),
34            onEnd: this.onDragEnd.createDelegate(this),
35            tolerance: 3,
36            autoStart: 300
37        });
38        this.tracker.initEl(this.handle);
39        p.on('beforedestroy', this.tracker.destroy, this.tracker);
40    },
41
42        // private
43    onDragStart: function(e){
44        this.dragging = true;
45        this.startHeight = this.panel.el.getHeight();
46        this.fireEvent('dragstart', this, e);
47    },
48
49        // private
50    onDrag: function(e){
51        this.panel.setHeight((this.startHeight-this.tracker.getOffset()[1]).constrain(this.minHeight, this.maxHeight));
52        this.fireEvent('drag', this, e);
53    },
54
55        // private
56    onDragEnd: function(e){
57        this.dragging = false;
58        this.fireEvent('dragend', this, e);
59    }
60});
Note: See TracBrowser for help on using the repository browser.