3 * @class Roo.bootstrap.panel.Grid
4 * @extends Roo.bootstrap.panel.Content
6 * Create a new GridPanel.
7 * @cfg {Roo.bootstrap.Table} grid The grid for this panel
8 * @param {String/Object} config A string to set only the panel's title, or a config object
10 new Roo.bootstrap.panel.Grid({
19 Roo.bootstrap.panel.Grid = function(config){
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);
27 var tool_el = this.wrapper.createChild();
28 this.toolbar = Roo.factory(config.toolbar);
30 if (config.toolbar.items) {
31 ti = config.toolbar.items ;
32 delete config.toolbar.items ;
36 this.toolbar.render(tool_el);
37 for(var i =0;i < ti.length;i++) {
38 // Roo.log(['add child', items[i]]);
39 nitems.push(this.toolbar.addxtype(Roo.apply({}, ti[i])));
41 this.toolbar.items = nitems;
43 delete config.toolbar;
46 this.wrapper.dom.appendChild(config.grid.getGridEl().dom);
47 config.el = this.wrapper;
49 Roo.bootstrap.panel.Grid.superclass.constructor.call(this, config);
52 // xtype created footer. - not sure if will work as we normally have to render first..
53 if (this.footer && !this.footer.el && this.footer.xtype) {
55 var ctr = this.grid.getView().getFooterPanel(true);
56 this.footer.dataSource = this.grid.dataSource;
57 this.footer = Roo.factory(this.footer, Roo);
58 this.footer.render(ctr);
63 config.grid.monitorWindowResize = false; // turn off autosizing
64 config.grid.autoHeight = false;
65 config.grid.autoWidth = false;
66 this.grid = config.grid;
67 this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
72 Roo.extend(Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Content, {
78 * Returns the grid for this panel
79 * @return {Roo.bootstrap.Table}
85 setSize : function(width, height){
86 if(!this.ignoreResize(width, height)){
88 var size = this.adjustForComponents(width, height);
89 grid.getGridEl().setSize(size.width, size.height);
91 var thd = grid.getGridEl().select('thead',true).first();
92 var tbd = grid.getGridEl().select('tbody', true).first();
94 tbd.setSize(width, height - thd.getHeight());
103 beforeSlide : function(){
104 this.grid.getView().scroller.clip();
107 afterSlide : function(){
108 this.grid.getView().scroller.unclip();
111 destroy : function(){
114 Roo.bootstrap.panel.Grid.superclass.destroy.call(this);