allow string based values for comboboxarray
[roojs1] / Roo / ViewPanel.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11
12 /**
13  * @class Roo.GridPanel
14  * @extends Roo.ContentPanel
15  * @constructor
16  * Create a new GridPanel.
17  * @param {Roo.grid.Grid} grid The grid for this panel
18  * @param {String/Object} config A string to set only the panel's title, or a config object
19  */
20 Roo.ViewPanel = function(el, config){
21      
22     this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
23         {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);
24         
25     this.wrapper.dom.appendChild(el.dom);
26     
27     Roo.ViewPanel.superclass.constructor.call(this, this.wrapper, config);
28     
29     if(this.toolbar){
30         this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
31     }
32     // xtype created footer. - not sure if will work as we normally have to render first..
33     if (this.footer && !this.footer.el && this.footer.xtype) {
34         
35         this.footer.container = this.wrapper.el; // this.getView().getFooterPanel(true);
36         this.footer.dataSource = this.view.store;
37         this.footer = Roo.factory(this.footer, Roo);
38         
39     }
40     //??? create teh view???
41     
42     //grid.monitorWindowResize = false; // turn off autosizing
43     //grid.autoHeight = false;
44     //grid.autoWidth = false;
45     //this.grid = grid;
46     //this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
47 };
48
49 Roo.extend(Roo.ViewPanel, Roo.ContentPanel, {
50     
51     autoCreate : true,
52     getId : function(){
53         return this.view.id;
54     },
55     
56     /**
57      * Returns the grid for this panel
58      * @return {Roo.grid.Grid} 
59      */
60     getGrid : function(){
61         return this.view;    
62     },
63     
64     setSize : function(width, height){
65         if(!this.ignoreResize(width, height)){
66             var grid = this.grid;
67             var size = this.adjustForComponents(width, height);
68             grid.getGridEl().setSize(size.width, size.height);
69             grid.autoSize();
70         }
71     },
72     
73     beforeSlide : function(){
74         this.grid.getView().scroller.clip();
75     },
76     
77     afterSlide : function(){
78         this.grid.getView().scroller.unclip();
79     },
80     
81     destroy : function(){
82         this.grid.destroy();
83         delete this.grid;
84         Roo.GridPanel.superclass.destroy.call(this); 
85     }
86 });