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 * @cfg {Roo.bootstrap.nav.Simplebar} toolbar the toolbar at the top of the grid.
9 * @param {Object} config A the config object
15 Roo.bootstrap.panel.Grid = function(config)
19 this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
20 {tag: "div", cls: "roo-layout-grid-wrapper roo-layout-inactive-content"}, true);
22 config.el = this.wrapper;
23 //this.el = this.wrapper;
25 if (config.container) {
26 // ctor'ed from a Border/panel.grid
29 this.wrapper.setStyle("overflow", "hidden");
30 this.wrapper.addClass('roo-grid-container');
36 var tool_el = this.wrapper.createChild();
37 this.toolbar = Roo.factory(config.toolbar);
39 if (config.toolbar.items) {
40 ti = config.toolbar.items ;
41 delete config.toolbar.items ;
45 this.toolbar.render(tool_el);
46 for(var i =0;i < ti.length;i++) {
47 // Roo.log(['add child', items[i]]);
48 nitems.push(this.toolbar.addxtype(Roo.apply({}, ti[i])));
50 this.toolbar.items = nitems;
52 delete config.toolbar;
55 Roo.bootstrap.panel.Grid.superclass.constructor.call(this, config);
56 config.grid.scrollBody = true;;
57 config.grid.monitorWindowResize = false; // turn off autosizing
58 config.grid.autoHeight = false;
59 config.grid.autoWidth = false;
61 this.grid = new config.grid.xns[config.grid.xtype](config.grid);
63 if (config.background) {
64 // render grid on panel activation (if panel background)
65 this.on('activate', function(gp) {
66 if (!gp.grid.rendered) {
67 gp.grid.render(this.wrapper);
68 gp.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
73 this.grid.render(this.wrapper);
74 this.grid.getGridEl().replaceClass("roo-layout-inactive-content", "roo-layout-component-panel");
77 //this.wrapper.dom.appendChild(config.grid.getGridEl().dom);
78 // ??? needed ??? config.el = this.wrapper;
83 // xtype created footer. - not sure if will work as we normally have to render first..
84 if (this.footer && !this.footer.el && this.footer.xtype) {
86 var ctr = this.grid.getView().getFooterPanel(true);
87 this.footer.dataSource = this.grid.dataSource;
88 this.footer = Roo.factory(this.footer, Roo);
89 this.footer.render(ctr);
99 Roo.extend(Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Content,
109 * Returns the grid for this panel
110 * @return {Roo.bootstrap.Table}
112 getGrid : function(){
116 setSize : function(width, height)
118 if (this.is_resizing) {
122 this.is_resizing = true;
123 if(!this.ignoreResize(width, height)){
124 var grid = this.grid;
125 var size = this.adjustForComponents(width, height);
126 // tfoot is not a footer?
129 var gridel = grid.getGridEl();
130 gridel.setSize(size.width, size.height);
132 var tbd = grid.getGridEl().select('tbody', true).first();
133 var thd = grid.getGridEl().select('thead',true).first();
134 var tbf= grid.getGridEl().select('tfoot', true).first();
137 size.height -= tbf.getHeight();
140 size.height -= thd.getHeight();
143 tbd.setSize(size.width, size.height );
144 // this is for the account management tab -seems to work there.
145 var thd = grid.getGridEl().select('thead',true).first();
147 // tbd.setSize(size.width, size.height - thd.getHeight());
152 this.is_resizing = false;
157 beforeSlide : function(){
158 this.grid.getView().scroller.clip();
161 afterSlide : function(){
162 this.grid.getView().scroller.unclip();
165 destroy : function(){
168 Roo.bootstrap.panel.Grid.superclass.destroy.call(this);