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;
24 if (config.container) {
25 // ctor'ed from a Border/panel.grid
28 this.wrapper.setStyle("overflow", "hidden");
29 this.wrapper.addClass('roo-grid-container');
35 var tool_el = this.wrapper.createChild();
36 this.toolbar = Roo.factory(config.toolbar);
38 if (config.toolbar.items) {
39 ti = config.toolbar.items ;
40 delete config.toolbar.items ;
44 this.toolbar.render(tool_el);
45 for(var i =0;i < ti.length;i++) {
46 // Roo.log(['add child', items[i]]);
47 nitems.push(this.toolbar.addxtype(Roo.apply({}, ti[i])));
49 this.toolbar.items = nitems;
51 delete config.toolbar;
54 Roo.bootstrap.panel.Grid.superclass.constructor.call(this, config);
55 config.grid.scrollBody = true;;
56 config.grid.monitorWindowResize = false; // turn off autosizing
57 config.grid.autoHeight = false;
58 config.grid.autoWidth = false;
60 this.grid = new config.grid.xns[config.grid.xtype](config.grid);
62 if (config.background) {
63 // render grid on panel activation (if panel background)
64 this.on('activate', function(gp) {
65 if (!gp.grid.rendered) {
66 gp.grid.render(this.wrapper);
67 gp.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
72 this.grid.render(this.wrapper);
73 this.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
76 //this.wrapper.dom.appendChild(config.grid.getGridEl().dom);
77 // ??? needed ??? config.el = this.wrapper;
82 // xtype created footer. - not sure if will work as we normally have to render first..
83 if (this.footer && !this.footer.el && this.footer.xtype) {
85 var ctr = this.grid.getView().getFooterPanel(true);
86 this.footer.dataSource = this.grid.dataSource;
87 this.footer = Roo.factory(this.footer, Roo);
88 this.footer.render(ctr);
98 Roo.extend(Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Content, {
104 * Returns the grid for this panel
105 * @return {Roo.bootstrap.Table}
107 getGrid : function(){
111 setSize : function(width, height){
112 if(!this.ignoreResize(width, height)){
113 var grid = this.grid;
114 var size = this.adjustForComponents(width, height);
115 // tfoot is not a footer?
118 var gridel = grid.getGridEl();
119 gridel.setSize(size.width, size.height);
121 var tbd = grid.getGridEl().select('tbody', true).first();
122 var thd = grid.getGridEl().select('thead',true).first();
123 var tbf= grid.getGridEl().select('tfoot', true).first();
126 size.height -= tbf.getHeight();
129 size.height -= thd.getHeight();
132 tbd.setSize(size.width, size.height );
133 // this is for the account management tab -seems to work there.
134 var thd = grid.getGridEl().select('thead',true).first();
136 // tbd.setSize(size.width, size.height - thd.getHeight());
145 beforeSlide : function(){
146 this.grid.getView().scroller.clip();
149 afterSlide : function(){
150 this.grid.getView().scroller.unclip();
153 destroy : function(){
156 Roo.bootstrap.panel.Grid.superclass.destroy.call(this);