try and get ctrl-enter to add a clear all
[roojs1] / Roo / GridPanel.js
1
2 /**
3  * @class Roo.GridPanel
4  * @extends Roo.ContentPanel
5  * @parent Roo.BorderLayout Roo.LayoutDialog builder
6  * @constructor
7  * Create a new GridPanel.
8  * @cfg {Roo.grid.Grid} grid The grid for this panel
9  */
10 Roo.GridPanel = function(grid, config){
11     
12     // universal ctor...
13     if (typeof(grid.grid) != 'undefined') {
14         config = grid;
15         grid = config.grid;
16     }
17     this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
18         {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);
19         
20     this.wrapper.dom.appendChild(grid.getGridEl().dom);
21     
22     Roo.GridPanel.superclass.constructor.call(this, this.wrapper, config);
23     
24     if(this.toolbar){
25         this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
26     }
27     // xtype created footer. - not sure if will work as we normally have to render first..
28     if (this.footer && !this.footer.el && this.footer.xtype) {
29         
30         this.footer.container = this.grid.getView().getFooterPanel(true);
31         this.footer.dataSource = this.grid.dataSource;
32         this.footer = Roo.factory(this.footer, Roo);
33         
34     }
35     
36     grid.monitorWindowResize = false; // turn off autosizing
37     grid.autoHeight = false;
38     grid.autoWidth = false;
39     this.grid = grid;
40     this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
41 };
42
43 Roo.extend(Roo.GridPanel, Roo.ContentPanel, {
44     getId : function(){
45         return this.grid.id;
46     },
47     
48     /**
49      * Returns the grid for this panel
50      * @return {Roo.grid.Grid} 
51      */
52     getGrid : function(){
53         return this.grid;    
54     },
55     
56     setSize : function(width, height){
57         if(!this.ignoreResize(width, height)){
58             var grid = this.grid;
59             var size = this.adjustForComponents(width, height);
60             grid.getGridEl().setSize(size.width, size.height);
61             grid.autoSize();
62         }
63     },
64     
65     beforeSlide : function(){
66         this.grid.getView().scroller.clip();
67     },
68     
69     afterSlide : function(){
70         this.grid.getView().scroller.unclip();
71     },
72     
73     destroy : function(){
74         this.grid.destroy();
75         delete this.grid;
76         Roo.GridPanel.superclass.destroy.call(this); 
77     }
78 });