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 {Object} config A the config object
14 Roo.bootstrap.panel.Grid = function(config){
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);
22 var tool_el = this.wrapper.createChild();
23 this.toolbar = Roo.factory(config.toolbar);
25 if (config.toolbar.items) {
26 ti = config.toolbar.items ;
27 delete config.toolbar.items ;
31 this.toolbar.render(tool_el);
32 for(var i =0;i < ti.length;i++) {
33 // Roo.log(['add child', items[i]]);
34 nitems.push(this.toolbar.addxtype(Roo.apply({}, ti[i])));
36 this.toolbar.items = nitems;
38 delete config.toolbar;
41 Roo.bootstrap.panel.Grid.superclass.constructor.call(this, config);
43 config.grid.monitorWindowResize = false; // turn off autosizing
44 config.grid.autoHeight = false;
45 config.grid.autoWidth = false;
47 this.grid = new config.grid.xns[config.grid.xtype](config.grid);
49 this.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
50 if (config.background) {
51 // render grid on panel activation (if panel background)
52 this.on('activate', function(gp) {
53 if (!gp.grid.rendered) {
59 this.grid.render(this.wrapper);
61 //this.wrapper.dom.appendChild(config.grid.getGridEl().dom);
62 // ??? needed ??? config.el = this.wrapper;
67 // xtype created footer. - not sure if will work as we normally have to render first..
68 if (this.footer && !this.footer.el && this.footer.xtype) {
70 var ctr = this.grid.getView().getFooterPanel(true);
71 this.footer.dataSource = this.grid.dataSource;
72 this.footer = Roo.factory(this.footer, Roo);
73 this.footer.render(ctr);
83 Roo.extend(Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Content, {
89 * Returns the grid for this panel
90 * @return {Roo.bootstrap.Table}
96 setSize : function(width, height){
97 if(!this.ignoreResize(width, height)){
99 var size = this.adjustForComponents(width, height);
100 var gridel = grid.getGridEl();
101 gridel.setSize(size.width, size.height);
103 var thd = grid.getGridEl().select('thead',true).first();
104 var tbd = grid.getGridEl().select('tbody', true).first();
106 tbd.setSize(width, height - thd.getHeight());
115 beforeSlide : function(){
116 this.grid.getView().scroller.clip();
119 afterSlide : function(){
120 this.grid.getView().scroller.unclip();
123 destroy : function(){
126 Roo.bootstrap.panel.Grid.superclass.destroy.call(this);