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)
18 this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
19 {tag: "div", cls: "roo-layout-grid-wrapper roo-layout-inactive-content"}, true);
21 config.el = this.wrapper;
22 //this.el = this.wrapper;
25 var tool_el = this.wrapper.createChild();
26 this.toolbar = Roo.factory(config.toolbar);
28 if (config.toolbar.items) {
29 ti = config.toolbar.items ;
30 delete config.toolbar.items ;
34 this.toolbar.render(tool_el);
35 for(var i =0;i < ti.length;i++) {
36 // Roo.log(['add child', items[i]]);
37 nitems.push(this.toolbar.addxtype(Roo.apply({}, ti[i])));
39 this.toolbar.items = nitems;
41 delete config.toolbar;
44 Roo.bootstrap.panel.Grid.superclass.constructor.call(this, config);
46 config.grid.monitorWindowResize = false; // turn off autosizing
47 config.grid.autoHeight = false;
48 config.grid.autoWidth = false;
50 this.grid = new config.grid.xns[config.grid.xtype](config.grid);
52 if (config.background) {
53 // render grid on panel activation (if panel background)
54 this.on('activate', function(gp) {
55 if (!gp.grid.rendered) {
57 gp.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
63 this.grid.render(this.wrapper);
64 this.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
67 //this.wrapper.dom.appendChild(config.grid.getGridEl().dom);
68 // ??? needed ??? config.el = this.wrapper;
73 // xtype created footer. - not sure if will work as we normally have to render first..
74 if (this.footer && !this.footer.el && this.footer.xtype) {
76 var ctr = this.grid.getView().getFooterPanel(true);
77 this.footer.dataSource = this.grid.dataSource;
78 this.footer = Roo.factory(this.footer, Roo);
79 this.footer.render(ctr);
89 Roo.extend(Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Content, {
95 * Returns the grid for this panel
96 * @return {Roo.bootstrap.Table}
102 setSize : function(width, height){
103 if(!this.ignoreResize(width, height)){
104 var grid = this.grid;
105 var size = this.adjustForComponents(width, height);
106 var gridel = grid.getGridEl();
107 gridel.setSize(size.width, size.height);
109 var thd = grid.getGridEl().select('thead',true).first();
110 var tbd = grid.getGridEl().select('tbody', true).first();
112 tbd.setSize(width, height - thd.getHeight());
121 beforeSlide : function(){
122 this.grid.getView().scroller.clip();
125 afterSlide : function(){
126 this.grid.getView().scroller.unclip();
129 destroy : function(){
132 Roo.bootstrap.panel.Grid.superclass.destroy.call(this);