Roo/Template.js
[roojs1] / Roo / BorderLayout.js
index 50cb276..dec3ad2 100644 (file)
@@ -476,23 +476,34 @@ layout.addxtype({
         this.beginUpdate();
         // add children..
         var region = '';
+        var abn = {};
         Roo.each(xitems, function(i)  {
-            region = nb && i.region && !i.background ? i.region : false;
+            region = nb && i.region ? i.region : false;
             
             var add = ret.addxtype(i);
            
             if (region) {
-                nb[region] = add;
+                nb[region] = nb[region] == undefined ? 0 : nb[region]+1;
+                if (!i.background) {
+                    abn[region] = nb[region] ;
+                }
             }
             
         });
         this.endUpdate();
+
         // make the last non-background panel active..
-        //if (nb) { Roo.log(nb); }
+        //if (nb) { Roo.log(abn); }
         if (nb) {
-            for(var r in nb) {
-                if (r == undefined) continue;
-               this.getRegion(r).showPanel(nb[r]);
+            
+            for(var r in abn) {
+                region = this.getRegion(r);
+                if (region) {
+                    // tried using nb[r], but it does not work..
+                     
+                    region.showPanel(abn[r]);
+                   
+                }
             }
         }
         return ret;