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])));
43 delete config.toolbar;
45 this.wrapper.dom.appendChild(config.grid.getGridEl().dom);
46 config.el = this.wrapper;
48 Roo.bootstrap.panel.Grid.superclass.constructor.call(this, config);
51 // xtype created footer. - not sure if will work as we normally have to render first..
52 if (this.footer && !this.footer.el && this.footer.xtype) {
54 var ctr = this.grid.getView().getFooterPanel(true);
55 this.footer.dataSource = this.grid.dataSource;
56 this.footer = Roo.factory(this.footer, Roo);
57 this.footer.render(ctr);
62 config.grid.monitorWindowResize = false; // turn off autosizing
63 config.grid.autoHeight = false;
64 config.grid.autoWidth = false;
65 this.grid = config.grid;
66 this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
71 Roo.extend(Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Content, {
77 * Returns the grid for this panel
78 * @return {Roo.bootstrap.Table}
84 setSize : function(width, height){
85 if(!this.ignoreResize(width, height)){
87 var size = this.adjustForComponents(width, height);
88 grid.getGridEl().setSize(size.width, size.height);
90 var thd = grid.getGridEl().select('thead',true).first();
91 var tbd = grid.getGridEl().select('tbody', true).first();
93 tbd.setSize(width, height - thd.getHeight());
102 beforeSlide : function(){
103 this.grid.getView().scroller.clip();
106 afterSlide : function(){
107 this.grid.getView().scroller.unclip();
110 destroy : function(){
113 Roo.bootstrap.panel.Grid.superclass.destroy.call(this);