Roo/bootstrap/layout/Border.js
authorAlan Knowles <alan@roojs.com>
Fri, 7 Jul 2017 02:09:54 +0000 (10:09 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 7 Jul 2017 02:09:54 +0000 (10:09 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/layout/Border.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 36a0fdd..08ae3a7 100644 (file)
@@ -359,7 +359,7 @@ layout.addxtype({
                     // render grid on panel activation (if panel background)
                     ret.on('activate', function(gp) {
                         if (!gp.grid.rendered) {
-                            gp.grid.render(cfg.grid.getGridEl());
+                            gp.grid.render(gp.grid.getGridEl());
                         }
                     });
                 } else {
index 3d6842f..2f98060 100644 (file)
@@ -5672,6 +5672,15 @@ Roo.LoadMask.prototype = {
 Roo.bootstrap.Table = function(config){
     Roo.bootstrap.Table.superclass.constructor.call(this, config);
     
+    if (config.container) {
+        // ctor'ed from a Border/panel.grid
+        this.container = Roo.get(config.container);
+        this.container.update("");
+        this.container.setStyle("overflow", "hidden");
+        this.container.addClass('x-grid-container');
+
+    }
+    
     // BC...
     this.rowSelection = (typeof(config.RowSelection) != 'undefined') ? config.RowSelection : this.rowSelection;
     this.cellSelection = (typeof(config.CellSelection) != 'undefined') ? config.CellSelection : this.cellSelection;
@@ -5837,7 +5846,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     layout : false,
     
     // Roo.Element - the tbody
-    mainBody: false, 
+    mainBody: false,
+    
+    
+    container: false, // used by gridpanel...
     
     getAutoCreate : function()
     {
@@ -6623,8 +6635,14 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         });
         
         return rowIndex;
+    },
+     /**
+     * Returns the grid's underlying element = used by panel.Grid
+     * @return {Element} The element
+     */
+    getGridEl : function(){
+        return this.container;
     }
-   
 });
 
  
@@ -31454,7 +31472,7 @@ layout.addxtype({
                 //var el = this.getRegion(region).el.createChild();
                 var el = this.el.createChild();
                 // create the grid first...
-                //cfg.grid.el = el;
+                cfg.grid.container = el;
                 cfg.grid = new cfg.grid.xns[cfg.grid.xtype](cfg.grid);
                 
                 
@@ -31470,11 +31488,11 @@ layout.addxtype({
                     // render grid on panel activation (if panel background)
                     ret.on('activate', function(gp) {
                         if (!gp.grid.rendered) {
-                            gp.grid.render(el);
+                            gp.grid.render(gp.grid.getGridEl());
                         }
                     });
                 } else {
-                    cfg.grid.render(el);
+                    cfg.grid.render(cfg.grid.getGridEl());
                 }
                 break;
            
index 1d999b5..e80256e 100644 (file)
@@ -222,11 +222,11 @@ um.showLoadIndicator=false;um.on('beforeupdate',this.onBeforeLoad,this);um.on('u
 },onBeforeLoad:function(){if(!this.disabled){this.el.mask(this.msg,this.msgCls);}},destroy:function(){if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);
 }else{var um=this.el.getUpdateManager();um.un('beforeupdate',this.onBeforeLoad,this);um.un('update',this.onLoad,this);um.un('failure',this.onLoad,this);}}};
 // Roo/bootstrap/Table.js
-Roo.bootstrap.Table=function(A){Roo.bootstrap.Table.superclass.constructor.call(this,A);this.rowSelection=(typeof(A.RowSelection)!='undefined')?A.RowSelection:this.rowSelection;this.cellSelection=(typeof(A.CellSelection)!='undefined')?A.CellSelection:this.cellSelection;
-this.headerShow=(typeof(A.thead)!='undefined')?A.thead:this.headerShow;this.footerShow=(typeof(A.tfoot)!='undefined')?A.tfoot:this.footerShow;if(this.sm){this.selModel=Roo.factory(this.sm,Roo.bootstrap.Table);this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;
-}if(this.cm&&typeof(this.cm.config)=='undefined'){this.colModel=new Roo.grid.ColumnModel(this.cm);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;}if(this.store){this.store=Roo.factory(this.store,Roo.data);this.ds=this.store;this.ds.xmodule=this.xmodule||false;
-}if(this.footer&&this.store){this.footer.dataSource=this.ds;this.footer=Roo.factory(this.footer);}this.addEvents({"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"mouseover":true,"mouseout":true,'rowclass':true,'rowsrendered':true,"contextmenu":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true}
-);};Roo.extend(Roo.bootstrap.Table,Roo.bootstrap.Component,{cls:false,align:false,bgcolor:false,border:false,cellpadding:false,cellspacing:false,frame:false,rules:false,sortable:false,summary:false,width:false,striped:false,bordered:false,hover:false,condensed:false,responsive:false,sm:false,cm:false,store:false,loadMask:false,footerShow:true,headerShow:true,rowSelection:false,cellSelection:false,layout:false,mainBody:false,getAutoCreate:function(){var A=Roo.apply({}
+Roo.bootstrap.Table=function(A){Roo.bootstrap.Table.superclass.constructor.call(this,A);if(A.container){this.container=Roo.get(A.container);this.container.update("");this.container.setStyle("overflow","hidden");this.container.addClass('x-grid-container');}
+this.rowSelection=(typeof(A.RowSelection)!='undefined')?A.RowSelection:this.rowSelection;this.cellSelection=(typeof(A.CellSelection)!='undefined')?A.CellSelection:this.cellSelection;this.headerShow=(typeof(A.thead)!='undefined')?A.thead:this.headerShow;this.footerShow=(typeof(A.tfoot)!='undefined')?A.tfoot:this.footerShow;
+if(this.sm){this.selModel=Roo.factory(this.sm,Roo.bootstrap.Table);this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;}if(this.cm&&typeof(this.cm.config)=='undefined'){this.colModel=new Roo.grid.ColumnModel(this.cm);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;
+}if(this.store){this.store=Roo.factory(this.store,Roo.data);this.ds=this.store;this.ds.xmodule=this.xmodule||false;}if(this.footer&&this.store){this.footer.dataSource=this.ds;this.footer=Roo.factory(this.footer);}this.addEvents({"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"mouseover":true,"mouseout":true,'rowclass':true,'rowsrendered':true,"contextmenu":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true}
+);};Roo.extend(Roo.bootstrap.Table,Roo.bootstrap.Component,{cls:false,align:false,bgcolor:false,border:false,cellpadding:false,cellspacing:false,frame:false,rules:false,sortable:false,summary:false,width:false,striped:false,bordered:false,hover:false,condensed:false,responsive:false,sm:false,cm:false,store:false,loadMask:false,footerShow:true,headerShow:true,rowSelection:false,cellSelection:false,layout:false,mainBody:false,container:false,getAutoCreate:function(){var A=Roo.apply({}
 ,Roo.bootstrap.Table.superclass.getAutoCreate.call(this));A={tag:'table',cls:'table',cn:[]};if(this.striped){A.cls+=' table-striped';}if(this.hover){A.cls+=' table-hover';}if(this.bordered){A.cls+=' table-bordered';}if(this.condensed){A.cls+=' table-condensed';
 }if(this.responsive){A.cls+=' table-responsive';}if(this.cls){A.cls+=' '+this.cls;}if(this.align){A.align=this.align;}if(this.bgcolor){A.bgcolor=this.bgcolor;}if(this.border){A.border=this.border;}if(this.cellpadding){A.cellpadding=this.cellpadding;}if(this.cellspacing){A.cellspacing=this.cellspacing;
 }if(this.frame){A.frame=this.frame;}if(this.rules){A.rules=this.rules;}if(this.sortable){A.sortable=this.sortable;}if(this.summary){A.summary=this.summary;}if(this.width){A.width=this.width;}if(this.layout){A.style=(typeof(A.style)=='undefined')?('table-layout:'+this.layout+';'):(A.style+('table-layout:'+this.layout+';'));
@@ -260,7 +260,7 @@ return (typeof(B[A])=='undefined')?false:B[A];},renderRow:function(cm,ds,A){var
 }if(typeof(E.cls)!='undefined'){td.cls=(typeof(td.cls)=='undefined')?E.cls:(td.cls+' '+E.cls);}['xs','sm','md','lg'].map(function(I){if(typeof(E[I])=='undefined'){return;}if(!E[I]){td.cls+=' hidden-'+I;return;}td.cls+=' col-'+I+'-'+E[I];});B.cn.push(td);}
 B.cellObjects=C;return B;},onBeforeLoad:function(){},clear:function(){this.el.select('tbody',true).first().dom.innerHTML='';},setRowVisibility:function(A,B){var bt=this.mainBody.dom;var C=this.el.select('tbody > tr',true).elements;if(typeof(C[A])=='undefined'){return;
 }C[A].dom.style.display=B?'':'none';},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.bootstrap.Table.RowSelectionModel();}return this.selModel;},renderCellObject:function(r){var A=this;var t=r.cfg.render(r.container);if(r.cfg.cn){Roo.each(r.cfg.cn,function(c){var B={container:t.getChildContainer(),cfg:c}
-;A.renderCellObject(B);})}},getRowIndex:function(A){var B=-1;Roo.each(this.el.select('tbody > tr',true).elements,function(el,C){if(el!=A){return;}B=C;});return B;}});
+;A.renderCellObject(B);})}},getRowIndex:function(A){var B=-1;Roo.each(this.el.select('tbody > tr',true).elements,function(el,C){if(el!=A){return;}B=C;});return B;},getGridEl:function(){return this.container;}});
 // Roo/bootstrap/TableCell.js
 Roo.bootstrap.TableCell=function(A){Roo.bootstrap.TableCell.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.TableCell,Roo.bootstrap.Component,{html:false,cls:false,tag:false,abbr:false,align:false,axis:false,bgcolor:false,charoff:false,colspan:false,headers:false,height:false,nowrap:false,rowspan:false,scope:false,valign:false,width:false,getAutoCreate:function(){var A=Roo.apply({}
 ,Roo.bootstrap.TableCell.superclass.getAutoCreate.call(this));A={tag:'td'};if(this.tag){A.tag=this.tag;}if(this.html){A.html=this.html}if(this.cls){A.cls=this.cls}if(this.abbr){A.abbr=this.abbr}if(this.align){A.align=this.align}if(this.axis){A.axis=this.axis}
@@ -1317,10 +1317,11 @@ b.height=C-(m.top+m.bottom);var L=(b.width+m.left+m.right);b.x=w-L+m.left;b.y=D+
 },findPanel:function(A){var rs=this.regions;for(var B in rs){if(typeof rs[B]!="function"){var p=rs[B].getPanel(A);if(p){return p;}}}return null;},showPanel:function(A){var rs=this.regions;for(var B in rs){var r=rs[B];if(typeof r!="function"){if(r.hasPanel(A)){return r.showPanel(A);
 }}}return null;},addxtype:function(A){var B=false;if(typeof(A.region)=='undefined'){Roo.log("Failed to add Panel, region was not set");Roo.log(A);return false;}var C=A.region;delete A.region;var D=[];if(A.items){D=A.items;delete A.items;}var nb=false;switch(A.xtype){case 'Content':case 'Scroll':case 'View':A.autoCreate=true;
 B=new A.xns[A.xtype](A);this.add(C,B);break;case 'Nest':var E=A.layout;E.el=this.el.createChild();E.items=E.items||[];delete A.layout;D=E.items;if(C=='center'&&this.active&&this.getRegion('center').panels.length<1){A.background=false;}A.layout=new Roo.bootstrap.layout.Border(E);
-B=new A.xns[A.xtype](A);this.add(C,B);nb={};break;case 'Grid':var el=this.el.createChild();A.grid=new A.grid.xns[A.grid.xtype](A.grid);if(C=='center'&&this.active){A.background=false;}B=new A.xns[A.xtype](A);this.add(C,B);if(A.background){B.on('activate',function(gp){if(!gp.grid.rendered){gp.grid.render(el);
-}});}else{A.grid.render(el);}break;case 'Border':B=this;break;default:Roo.log(A);throw "Can not add '"+A.xtype+"' to Border";return null;}this.beginUpdate();var C='';var F={};Roo.each(D,function(i){C=nb&&i.region?i.region:false;var G=B.addxtype(i);if(C){nb[C]=nb[C]==undefined?0:nb[C]+1;
-if(!i.background){F[C]=nb[C];}}});this.endUpdate();if(nb){for(var r in F){C=this.getRegion(r);if(C){C.showPanel(F[r]);}}}return B;},factory:function(A){var B=Roo.bootstrap.layout.Border.regions;var C=A.region;A.mgr=this;var r=Roo.bootstrap.layout;Roo.log(C);
-switch(C){case "north":return new r.North(A);case "south":return new r.South(A);case "east":return new r.East(A);case "west":return new r.West(A);case "center":return new r.Center(A);}throw 'Layout region "'+C+'" not supported.';}});
+B=new A.xns[A.xtype](A);this.add(C,B);nb={};break;case 'Grid':var el=this.el.createChild();A.grid.container=el;A.grid=new A.grid.xns[A.grid.xtype](A.grid);if(C=='center'&&this.active){A.background=false;}B=new A.xns[A.xtype](A);this.add(C,B);if(A.background){B.on('activate',function(gp){if(!gp.grid.rendered){gp.grid.render(gp.grid.getGridEl());
+}});}else{A.grid.render(A.grid.getGridEl());}break;case 'Border':B=this;break;default:Roo.log(A);throw "Can not add '"+A.xtype+"' to Border";return null;}this.beginUpdate();var C='';var F={};Roo.each(D,function(i){C=nb&&i.region?i.region:false;var G=B.addxtype(i);
+if(C){nb[C]=nb[C]==undefined?0:nb[C]+1;if(!i.background){F[C]=nb[C];}}});this.endUpdate();if(nb){for(var r in F){C=this.getRegion(r);if(C){C.showPanel(F[r]);}}}return B;},factory:function(A){var B=Roo.bootstrap.layout.Border.regions;var C=A.region;A.mgr=this;
+var r=Roo.bootstrap.layout;Roo.log(C);switch(C){case "north":return new r.North(A);case "south":return new r.South(A);case "east":return new r.East(A);case "west":return new r.West(A);case "center":return new r.Center(A);}throw 'Layout region "'+C+'" not supported.';
+}});
 // Roo/bootstrap/layout/Basic.js
 Roo.bootstrap.layout.Basic=function(A){this.mgr=A.mgr;this.position=A.region;var B=A.skipConfig;this.events={"beforeremove":true,"invalidated":true,"visibilitychange":true,"paneladded":true,"panelremoved":true,"beforecollapse":true,"collapsed":true,"expanded":true,"slideshow":true,"slidehide":true,"panelactivated":true,"resized":true}
 ;this.panels=new Roo.util.MixedCollection();this.panels.getKey=this.getPanelId.createDelegate(this);this.box=null;this.activePanel=null;if(A.listeners||A.events){Roo.bootstrap.layout.Basic.superclass.constructor.call(this,{listeners:A.listeners||{},events:A.events||{}