roojs-core.js
authorAlan Knowles <alan@roojs.com>
Thu, 21 Sep 2017 04:49:16 +0000 (12:49 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 21 Sep 2017 04:49:16 +0000 (12:49 +0800)
roojs-core-debug.js

roojs-core-debug.js
roojs-core.js

index 290ae42..fdd6dd7 100644 (file)
@@ -16038,6 +16038,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
         Roo.debug &&  Roo.log(this);
         
         var tree = this._tree ? this._tree() : this.tree();
+        var named_el = false;
 
         
         if (!el && typeof(this.parent) == 'string' && this.parent.substring(0,1) == '#') {
@@ -16045,6 +16046,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
             var ename = this.parent.substr(1);
             this.parent = false;
             Roo.debug && Roo.log(ename);
+            named_el = true;
             switch (ename) {
                 case 'bootstrap-body':
                     if (typeof(tree.el) != 'undefined' && tree.el == document.body)  {
@@ -16087,6 +16089,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
                     // fall through
                 default:
                     el = Roo.get(ename);
+                     
                     break;
             }
                 
@@ -16111,7 +16114,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, {
         
         
         
-        if (!this.parent && is_alt) {
+        if (!this.parent && is_alt && !named_el) {
             //el = Roo.get(document.body);
             this.parent = { el : true };
         }
index 40e5f7d..8169651 100644 (file)
@@ -651,13 +651,13 @@ this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.
 return this;},onResize:function(A,B,C,D){},onPosition:function(x,y){},adjustSize:function(w,h){if(this.autoWidth){w='auto';}if(this.autoHeight){h='auto';}return {width:w,height:h};},adjustPosition:function(x,y){return {x:x,y:y};}});
 // Roo/XComponent.js
 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;};Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;
-var hp=this.parent?1:0;Roo.debug&&Roo.log(this);var A=this._tree?this._tree():this.tree();if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var B=this.parent.substr(1);this.parent=false;Roo.debug&&Roo.log(B);switch(B){case 'bootstrap-body':if(typeof(A.el)!='undefined'&&A.el==document.body){this.parent={el:true}
+var hp=this.parent?1:0;Roo.debug&&Roo.log(this);var A=this._tree?this._tree():this.tree();var B=false;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var C=this.parent.substr(1);this.parent=false;Roo.debug&&Roo.log(C);B=true;switch(C){case 'bootstrap-body':if(typeof(A.el)!='undefined'&&A.el==document.body){this.parent={el:true}
 ;break;}if(["Nest","Content","Grid","Tree"].indexOf(A.xtype)>-1){this.parent={el:new Roo.bootstrap.layout.Border({el:document.body,center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:true,hideTabs:false}})};break;}if(typeof(Roo.bootstrap.Body)!='undefined'){this.parent={el:new Roo.bootstrap.Body()}
-;Roo.debug&&Roo.log("setting el to doc body");}else{throw "Container is bootstrap body, but Roo.bootstrap.Body is not defined";}break;case 'bootstrap':this.parent={el:true};default:el=Roo.get(B);break;}if(!el&&!this.parent){Roo.debug&&Roo.log("Warning - element can not be found :#"+B);
-return;}}Roo.debug&&Roo.log("EL:");Roo.debug&&Roo.log(el);Roo.debug&&Roo.log("this.parent.el:");Roo.debug&&Roo.log(this.parent.el);var C=Roo.XComponent.is_alt||(typeof(A.el)!='undefined'&&A.el==document.body)||(typeof(Roo.bootstrap)!='undefined'&&A.xns==Roo.bootstrap)||(typeof(Roo.mailer)!='undefined'&&A.xns==Roo.mailer);
-if(!this.parent&&C){this.parent={el:true};}if(!this.parent){Roo.debug&&Roo.log("no parent - creating one");el=el?Roo.get(el):false;if(typeof(Roo.BorderLayout)=='undefined'){this.parent={el:new Roo.bootstrap.layout.Border({el:el||document.body,center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:false,hideTabs:true,minTabWidth:140,overflow:'visible'}
+;Roo.debug&&Roo.log("setting el to doc body");}else{throw "Container is bootstrap body, but Roo.bootstrap.Body is not defined";}break;case 'bootstrap':this.parent={el:true};default:el=Roo.get(C);break;}if(!el&&!this.parent){Roo.debug&&Roo.log("Warning - element can not be found :#"+C);
+return;}}Roo.debug&&Roo.log("EL:");Roo.debug&&Roo.log(el);Roo.debug&&Roo.log("this.parent.el:");Roo.debug&&Roo.log(this.parent.el);var D=Roo.XComponent.is_alt||(typeof(A.el)!='undefined'&&A.el==document.body)||(typeof(Roo.bootstrap)!='undefined'&&A.xns==Roo.bootstrap)||(typeof(Roo.mailer)!='undefined'&&A.xns==Roo.mailer);
+if(!this.parent&&D&&!B){this.parent={el:true};}if(!this.parent){Roo.debug&&Roo.log("no parent - creating one");el=el?Roo.get(el):false;if(typeof(Roo.BorderLayout)=='undefined'){this.parent={el:new Roo.bootstrap.layout.Border({el:el||document.body,center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:false,hideTabs:true,minTabWidth:140,overflow:'visible'}
 })};}else{this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})};}}if(!this.parent.el){return;}A.region=A.region||this.region;
-var D=false;if(this.parent.el===true){this.parent.el=Roo.factory(A);D=true;}this.el=this.parent.el.addxtype(A,undefined,D);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;this.parentLayout=this.parent.layout||false;}});Roo.apply(Roo.XComponent,{hideProgress:false,buildCompleted:false,topModule:false,modules:[],elmodules:[],is_alt:false,build_from_html:false,register:function(A){Roo.XComponent.event.fireEvent('register',A);
+var E=false;if(this.parent.el===true){this.parent.el=Roo.factory(A);E=true;}this.el=this.parent.el.addxtype(A,undefined,E);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;this.parentLayout=this.parent.layout||false;}});Roo.apply(Roo.XComponent,{hideProgress:false,buildCompleted:false,topModule:false,modules:[],elmodules:[],is_alt:false,build_from_html:false,register:function(A){Roo.XComponent.event.fireEvent('register',A);
 switch(typeof(A.disabled)){case 'undefined':break;case 'function':if(A.disabled()){return;}break;default:if(A.disabled){return;}break;}this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;
 }var ar=str.split('.');var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;}Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str;
 }o=o[e];});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){Roo.XComponent.event.fireEvent('beforebuild',A);var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.debug&&Roo.log("parent:toObject failed: "+e.toString());return;