sync
[roojs1] / roojs-bootstrap-debug.js
index f54f511..95fa5a0 100644 (file)
@@ -1513,7 +1513,19 @@ Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component,  {
     {
         Roo.log('img onclick');
         this.fireEvent('click', this, e);
+    },
+    /**
+     * Sets the url of the image - used to update it
+     * @param {String} url the url of the image
+     */
+    
+    setSrc : function(url)
+    {
+        this.src =  url;
+        this.el.select('img', true).first().dom.src =  url;
     }
+    
+    
    
 });
 
@@ -2456,7 +2468,7 @@ Roo.extend(Roo.bootstrap.MenuSeparator, Roo.bootstrap.Component,  {
  * @cfg {String} buttonPosition (left|right|center) default right
  * @cfg {Boolean} animate default true
  * @cfg {Boolean} allow_close default true
- * @cfg {Boolean} fitwindow default true
+ * @cfg {Boolean} fitwindow default false
  * @cfg {String} size (sm|lg) default empty
  * 
  * 
@@ -2698,8 +2710,8 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),  Roo.lib.Dom.getViewHeight(true));
         if (this.fitwindow) {
             var w = this.width || Roo.lib.Dom.getViewportWidth(true) - 30;
-            var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 30;
-            this.setSize(w,h)
+            var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60;
+            this.setSize(w,h);
         }
     },
     
@@ -2740,13 +2752,15 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         this.el.setStyle('zIndex', '10001');
        
         this.fireEvent('show', this);
-        this.items.forEach(function(e) {
-            e.layout ? e.layout() : false;
-                
-        });
-        this.resize();
         
+        this.resize();
         
+        (function () {
+            this.items.forEach( function(e) {
+                e.layout ? e.layout() : false;
+                    
+            });
+        }).defer(100,this);
         
     },
     hide : function()
@@ -5708,8 +5722,8 @@ Roo.bootstrap.Table = function(config){
   
     
     // BC...
-    this.rowSelection = (typeof(config.RowSelection) != 'undefined') ? config.RowSelection : this.rowSelection;
-    this.cellSelection = (typeof(config.CellSelection) != 'undefined') ? config.CellSelection : this.cellSelection;
+    this.rowSelection = (typeof(config.rowSelection) != 'undefined') ? config.rowSelection : this.rowSelection;
+    this.cellSelection = (typeof(config.cellSelection) != 'undefined') ? config.cellSelection : this.cellSelection;
     this.headerShow = (typeof(config.thead) != 'undefined') ? config.thead : this.headerShow;
     this.footerShow = (typeof(config.tfoot) != 'undefined') ? config.tfoot : this.footerShow;
     
@@ -5972,6 +5986,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         if(!this.store || !this.cm){
             return;
         }
+        if (this.selModel) {
+            this.selModel.initEvents();
+        }
+        
         
         //Roo.log('initEvents with ds!!!!');
         
@@ -5980,6 +5998,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         
         
+        
         var _this = this;
         
         Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
@@ -5996,7 +6015,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         if (this.footer) {
             this.footer.parentId = this.id;
             this.footer.onRender(this.el.select('tfoot tr td').first(), null);        
-        }
+        } 
         
         this.maskEl = new Roo.LoadMask(this.el, { store : this.ds, msgCls: 'roo-el-mask-msg' });
         
@@ -6156,12 +6175,12 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         
     },
-    
+        
     onDblClick : function(e,el)
     {
         var cell = Roo.get(el);
         
-        if(!cell || (!this.CellSelection && !this.RowSelection)){
+        if(!cell || (!this.cellSelection && !this.rowSelection)){
             return;
         }
         
@@ -6182,11 +6201,11 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         var cellIndex = cell.dom.cellIndex;
         var rowIndex = this.getRowIndex(row);
         
-        if(this.CellSelection){
+        if(this.cellSelection){
             this.fireEvent('celldblclick', this, cell, rowIndex, cellIndex, e);
         }
         
-        if(this.RowSelection){
+        if(this.rowSelection){
             this.fireEvent('rowdblclick', this, row, rowIndex, e);
         }
     },
@@ -6421,6 +6440,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     onUpdate : function(ds,record)
     {
         this.refreshRow(record);
+        this.autoSize();
     },
     
     onRemove : function(ds, record, index, isUpdate){
@@ -6472,7 +6492,9 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             index = ds.indexOf(record);
         }
         this.insertRow(ds, index, true);
+        this.autoSize();
         this.onRemove(ds, record, index+1, true);
+        this.autoSize();
         //this.syncRowHeights(index, index);
         //this.layout();
         this.fireEvent("rowupdated", this, index, record);
@@ -6713,13 +6735,15 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         var thd = this.getGridEl().select('thead',true).first();
         var tbd = this.getGridEl().select('tbody', true).first();
-        
+        var tfd = this.getGridEl().select('tfoot', true).first();
         
         var cw = ctr.getWidth();
         
         if (tbd) {
             
-            tbd.setSize(ctr.getWidth(), ctr.getHeight() - thd.getHeight());
+            tbd.setSize(ctr.getWidth(),
+                        ctr.getHeight() - (thd.getHeight() + (tfd ? tfd.getHeight() : 0))
+            );
             var barsize = (tbd.dom.offsetWidth - tbd.dom.clientWidth);
             cw -= barsize;
         }
@@ -8530,6 +8554,8 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
         }
         if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Roo.form.VTypes[this.vtype+'Mask']))){
             this.inputEl().on("keypress", this.filterKeys, this);
+        } else {
+            this.inputEl().relayEvent('keypress', this);
         }
        /* if(this.grow){
             this.el.on("keyup", this.onKeyUp,  this, {buffer:50});
@@ -17324,7 +17350,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
         this.isInput = true;
         this.component = this.el.select('.add-on', true).first() || false;
         this.component = (this.component && this.component.length === 0) ? false : this.component;
-        this.hasInput = this.component && this.inputEL().length;
+        this.hasInput = this.component && this.inputEl().length;
         
         if (typeof(this.minViewMode === 'string')) {
             switch (this.minViewMode) {
@@ -18103,6 +18129,54 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
     remove: function() 
     {
         this.picker().remove();
+    },
+    
+    validateValue : function(value)
+    {
+        if(value.length < 1)  {
+            if(this.allowBlank){
+                return true;
+            }
+            return false;
+        }
+        
+        if(value.length < this.minLength){
+            return false;
+        }
+        if(value.length > this.maxLength){
+            return false;
+        }
+        if(this.vtype){
+            var vt = Roo.form.VTypes;
+            if(!vt[this.vtype](value, this)){
+                return false;
+            }
+        }
+        if(typeof this.validator == "function"){
+            var msg = this.validator(value);
+            if(msg !== true){
+                return false;
+            }
+        }
+        
+        if(this.regex && !this.regex.test(value)){
+            return false;
+        }
+        
+        if(typeof(this.parseDate(value)) == 'undefined'){
+            return false;
+        }
+        
+        if (this.endDate !== Infinity && this.parseDate(value).getTime() > this.endDate.getTime()) {
+            return false;
+        }      
+        
+        if (this.startDate !== -Infinity && this.parseDate(value).getTime() < this.startDate.getTime()) {
+            return false;
+        } 
+        
+        
+        return true;
     }
    
 });
@@ -19224,12 +19298,20 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
             tag: 'input',
             id : id,
             type : this.inputType,
-            value : this.inputType == 'radio' ? this.inputValue : ((!this.checked) ? this.valueOff : this.inputValue),
+            value : this.inputValue,
             cls : 'roo-' + this.inputType, //'form-box',
             placeholder : this.placeholder || ''
             
         };
         
+         
+        var hidden =  {
+            tag: 'input',
+            type : 'hidden',
+            cls : 'roo-hidden-value',
+            value : this.checked ? this.valueOff : this.inputValue
+        };
+            
         if (this.weight) { // Validity check?
             cfg.cls += " " + this.inputType + "-" + this.weight;
         }
@@ -19240,10 +19322,13 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         
         if(this.checked){
             input.checked = this.checked;
+            
         }
         
+        
         if (this.name) {
-            input.name = this.name;
+            hidden.name = this.name;
+            input.name = '_hidden_' + this.name;
         }
         
         if (this.size) {
@@ -19258,7 +19343,13 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
             }
         });
         
-        var inputblock = input;
+        var inputblock = {
+            tag: 'span',
+            cn : [
+                    input,
+                    hidden
+                ]
+        };
          
         if (this.before || this.after) {
             
@@ -19276,6 +19367,7 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
             }
             
             inputblock.cn.push(input);
+            inputblock.cn.push(hidden);
             
             if (this.after) {
                 inputblock.cn.push({
@@ -19359,6 +19451,10 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
     {
         return this.el.select('input.roo-' + this.inputType,true).first();
     },
+    hiddenEl: function ()
+    {
+        return this.el.select('input.hidden-value',true).first();
+    },
     
     labelEl: function()
     {
@@ -19425,7 +19521,8 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         
         this.inputEl().dom.checked = state;
         
-        this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
+        
+        this.hiddenEl().dom.value = state ? this.inputValue : this.valueOff;
         
         if(suppressEvent !== true){
             this.fireEvent('check', this, state);
@@ -19440,7 +19537,7 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
             return this.getGroupValue();
         }
         
-        return this.inputEl().getValue();
+        return this.hiddenEl() ? this.hiddenEl().dom.value : this.value;
         
     },
     
@@ -19503,6 +19600,10 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
     
     validateRadio : function()
     {
+        if(this.allowBlank){
+            return true;
+        }
+        
         var valid = false;
         
         Roo.each(this.el.up('form').select('input[name='+this.name+']', true).elements, function(e){
@@ -19643,8 +19744,51 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
             group[i].el.findParent('.form-group', false, true).addClass(this.invalidClass);
         }
         
+    },
+    
+    disable : function()
+    {
+        if(this.inputType != 'radio'){
+            Roo.bootstrap.CheckBox.superclass.disable.call(this);
+            return;
+        }
+        
+        var _this = this;
+        
+        if(this.rendered){
+            Roo.each(this.el.up('form').select('input[name='+this.name+']', true).elements, function(e){
+                _this.getActionEl().addClass(this.disabledClass);
+                e.dom.disabled = true;
+            });
+        }
+        
+        this.disabled = true;
+        this.fireEvent("disable", this);
+        return this;
+    },
+
+    enable : function()
+    {
+        if(this.inputType != 'radio'){
+            Roo.bootstrap.CheckBox.superclass.enable.call(this);
+            return;
+        }
+        
+        var _this = this;
+        
+        if(this.rendered){
+            Roo.each(this.el.up('form').select('input[name='+this.name+']', true).elements, function(e){
+                _this.getActionEl().removeClass(this.disabledClass);
+                e.dom.disabled = false;
+            });
+        }
+        
+        this.disabled = false;
+        this.fireEvent("enable", this);
+        return this;
     }
     
+
 });
 
 Roo.apply(Roo.bootstrap.CheckBox, {
@@ -22403,8 +22547,7 @@ Roo.bootstrap.Table.RowSelectionModel = function(config){
     });
     Roo.bootstrap.Table.RowSelectionModel.superclass.constructor.call(this);
     this.locked = false;
-    this.initEvents();
-};
+ };
 
 Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSelectionModel,  {
     /**
@@ -22417,12 +22560,14 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
     initEvents : function()
     {
 
-        if(!this.grid.enableDragDrop && !this.grid.enableDrag){
-            this.grid.on("mousedown", this.handleMouseDown, this);
-        }else{ // allow click to work like normal
-            this.grid.on("rowclick", this.handleDragableRowClick, this);
-        }
-
+        //if(!this.grid.enableDragDrop && !this.grid.enableDrag){
+        //    this.growclickrid.on("mousedown", this.handleMouseDown, this);
+        //}else{ // allow click to work like normal
+         //   this.grid.on("rowclick", this.handleDragableRowClick, this);
+        //}
+        //this.grid.on("rowdblclick", this.handleMouseDBClick, this);
+        this.grid.on("rowclick", this.handleMouseDown, this);
+        
         this.rowNav = new Roo.KeyNav(this.grid.getGridEl(), {
             "up" : function(e){
                 if(!e.shiftKey){
@@ -22456,16 +22601,21 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
             },
             scope: this
         });
-
+        this.grid.store.on('load', function(){
+            this.selections.clear();
+        },this);
+        /*
         var view = this.grid.view;
         view.on("refresh", this.onRefresh, this);
         view.on("rowupdated", this.onRowUpdated, this);
         view.on("rowremoved", this.onRemove, this);
+        */
     },
 
     // private
-    onRefresh : function(){
-        var ds = this.grid.dataSource, i, v = this.grid.view;
+    onRefresh : function()
+    {
+        var ds = this.grid.store, i, v = this.grid.view;
         var s = this.selections;
         s.each(function(r){
             if((i = ds.indexOfId(r.id)) != -1){
@@ -22493,11 +22643,12 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
      * @param {Array} records The records to select
      * @param {Boolean} keepExisting (optional) True to keep existing selections
      */
-    selectRecords : function(records, keepExisting){
+    selectRecords : function(records, keepExisting)
+    {
         if(!keepExisting){
             this.clearSelections();
         }
-        var ds = this.grid.dataSource;
+           var ds = this.grid.store;
         for(var i = 0, len = records.length; i < len; i++){
             this.selectRow(ds.indexOf(records[i]), true);
         }
@@ -22523,15 +22674,17 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
      * @param {Boolean} keepExisting (optional) True to keep existing selections
      */
     selectLastRow : function(keepExisting){
-        this.selectRow(this.grid.dataSource.getCount() - 1, keepExisting);
+        //this.selectRow(this.grid.dataSource.getCount() - 1, keepExisting);
+        this.selectRow(this.grid.store.getCount() - 1, keepExisting);
     },
 
     /**
      * Selects the row immediately following the last selected row.
      * @param {Boolean} keepExisting (optional) True to keep existing selections
      */
-    selectNext : function(keepExisting){
-        if(this.last !== false && (this.last+1) < this.grid.dataSource.getCount()){
+    selectNext : function(keepExisting)
+    {
+           if(this.last !== false && (this.last+1) < this.grid.store.getCount()){
             this.selectRow(this.last+1, keepExisting);
             this.grid.getView().focusRow(this.last);
         }
@@ -22568,12 +22721,13 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
     /**
      * Clears all selections.
      */
-    clearSelections : function(fast){
+    clearSelections : function(fast)
+    {
         if(this.locked) {
             return;
         }
         if(fast !== true){
-            var ds = this.grid.dataSource;
+               var ds = this.grid.store;
             var s = this.selections;
             s.each(function(r){
                 this.deselectRow(ds.indexOfId(r.id));
@@ -22594,7 +22748,7 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
             return;
         }
         this.selections.clear();
-        for(var i = 0, len = this.grid.dataSource.getCount(); i < len; i++){
+        for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
             this.selectRow(i, true);
         }
     },
@@ -22613,7 +22767,7 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
      * @return {Boolean}
      */
     isSelected : function(index){
-        var r = typeof index == "number" ? this.grid.dataSource.getAt(index) : index;
+           var r = typeof index == "number" ? this.grid.store.getAt(index) : index;
         return (r && this.selections.key(r.id) ? true : false);
     },
 
@@ -22626,27 +22780,44 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
         return (this.selections.key(id) ? true : false);
     },
 
+
+    // private
+    handleMouseDBClick : function(e, t){
+       
+    },
     // private
-    handleMouseDown : function(e, t){
-        var view = this.grid.getView(), rowIndex;
-        if(this.isLocked() || (rowIndex = view.findRowIndex(t)) === false){
+    handleMouseDown : function(e, t)
+    {
+           var rowIndex = this.grid.headerShow  ? t.dom.rowIndex - 1 : t.dom.rowIndex ; // first row is header???
+        if(this.isLocked() || rowIndex < 0 ){
             return;
         };
         if(e.shiftKey && this.last !== false){
             var last = this.last;
             this.selectRange(last, rowIndex, e.ctrlKey);
             this.last = last; // reset the last
-            view.focusRow(rowIndex);
+            t.focus();
+    
         }else{
             var isSelected = this.isSelected(rowIndex);
-            if(e.button !== 0 && isSelected){
-                view.focusRow(rowIndex);
-            }else if(e.ctrlKey && isSelected){
+            //Roo.log("select row:" + rowIndex);
+            if(isSelected){
                 this.deselectRow(rowIndex);
-            }else if(!isSelected){
-                this.selectRow(rowIndex, e.button === 0 && (e.ctrlKey || e.shiftKey));
-                view.focusRow(rowIndex);
+            } else {
+                       this.selectRow(rowIndex, true);
             }
+    
+            /*
+                if(e.button !== 0 && isSelected){
+                alert('rowIndex 2: ' + rowIndex);
+                    view.focusRow(rowIndex);
+                }else if(e.ctrlKey && isSelected){
+                    this.deselectRow(rowIndex);
+                }else if(!isSelected){
+                    this.selectRow(rowIndex, e.button === 0 && (e.ctrlKey || e.shiftKey));
+                    view.focusRow(rowIndex);
+                }
+            */
         }
         this.fireEvent("afterselectionchange", this);
     },
@@ -22717,19 +22888,26 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
      * @param {Number} row The index of the row to select
      * @param {Boolean} keepExisting (optional) True to keep existing selections
      */
-    selectRow : function(index, keepExisting, preventViewNotify){
-        if(this.locked || (index < 0 || index >= this.grid.dataSource.getCount())) {
+    selectRow : function(index, keepExisting, preventViewNotify)
+    {
+           if(this.locked || (index < 0 || index > this.grid.store.getCount())) {
             return;
         }
         if(this.fireEvent("beforerowselect", this, index, keepExisting) !== false){
             if(!keepExisting || this.singleSelect){
                 this.clearSelections();
             }
-            var r = this.grid.dataSource.getAt(index);
+           
+            var r = this.grid.store.getAt(index);
+            //console.log('selectRow - record id :' + r.id);
+            
             this.selections.add(r);
             this.last = this.lastActive = index;
             if(!preventViewNotify){
-                this.grid.getView().onRowSelect(index);
+                var proxy = new Roo.Element(
+                                this.grid.getRowDom(index)
+                );
+                proxy.addClass('bg-info info');
             }
             this.fireEvent("rowselect", this, index, r);
             this.fireEvent("selectionchange", this);
@@ -22740,7 +22918,8 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
      * Deselects a row.
      * @param {Number} row The index of the row to deselect
      */
-    deselectRow : function(index, preventViewNotify){
+    deselectRow : function(index, preventViewNotify)
+    {
         if(this.locked) {
             return;
         }
@@ -22750,10 +22929,20 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
         if(this.lastActive == index){
             this.lastActive = false;
         }
-        var r = this.grid.dataSource.getAt(index);
+       
+        var r = this.grid.store.getAt(index);
+        if (!r) {
+            return;
+        }
+        
         this.selections.remove(r);
+        //.console.log('deselectRow - record id :' + r.id);
         if(!preventViewNotify){
-            this.grid.getView().onRowDeselect(index);
+       
+           var proxy = new Roo.Element(
+                this.grid.getRowDom(index)
+            );
+            proxy.removeClass('bg-info info');
         }
         this.fireEvent("rowdeselect", this, index);
         this.fireEvent("selectionchange", this);
@@ -22797,7 +22986,8 @@ Roo.extend(Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.Table.AbstractSe
             g.startEditing(newCell[0], newCell[1]);
         }
     }
-});/*
+});
+/*
  * Based on:
  * Ext JS Library 1.1.1
  * Copyright(c) 2006-2007, Ext JS, LLC.
@@ -31698,6 +31888,14 @@ Roo.extend(Roo.bootstrap.layout.Border, Roo.bootstrap.layout.Manager, {
         if(this.updating) {
             return;
         }
+        
+        // render all the rebions if they have not been done alreayd?
+        Roo.each(Roo.bootstrap.layout.Border.regions, function(region) {
+            if(this.regions[region] && !this.regions[region].bodyEl){
+                this.regions[region].onRender(this.el)
+            }
+        },this);
+        
         var size = this.getViewSize();
         var w = size.width;
         var h = size.height;
@@ -32478,12 +32676,13 @@ Roo.bootstrap.layout.Region = function(config)
      
     this.visible = true;
     this.collapsed = false;
+    this.unrendered_panels = [];
 };
 
 Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
 
     position: '', // set by wrapper (eg. north/south etc..)
-
+    unrendered_panels : null,  // unrendered panels.
     createBody : function(){
         /** This region's body element 
         * @type Roo.Element */
@@ -32553,6 +32752,15 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
         if(this.config.hidden){
             this.hide();
         }
+        
+        if (this.unrendered_panels && this.unrendered_panels.length) {
+            for (var i =0;i< this.unrendered_panels.length; i++) {
+                this.add(this.unrendered_panels[i]);
+            }
+            this.unrendered_panels = null;
+            
+        }
+        
     },
     
     applyConfig : function(c)
@@ -32665,6 +32873,10 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
 */
     updateBox : function(box)
     {
+        if (!this.bodyEl) {
+            return; // not rendered yet..
+        }
+        
         this.box = box;
         if(!this.collapsed){
             this.el.dom.style.left = box.x + "px";
@@ -32689,7 +32901,7 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
                 w += this.config.adjustments[0];
             }
         }
-        if(h !== null){
+        if(h !== null && h > 0){
             this.el.setHeight(h);
             h = this.titleEl && this.titleEl.isDisplayed() ? h - (this.titleEl.getHeight()||0) : h;
             h -= this.el.getBorderWidth("tb");
@@ -32841,7 +33053,8 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
 
     initTabs : function()
     {
-        this.bodyEl.setStyle("overflow", "hidden");
+        //this.bodyEl.setStyle("overflow", "hidden"); -- this is set in render?
+        
         var ts = new Roo.bootstrap.panel.Tabs({
                 el: this.bodyEl.dom,
                 tabPosition: this.bottomTabs ? 'bottom' : 'top',
@@ -32858,7 +33071,7 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
         ts.maxTabWidth = this.config.maxTabWidth || 250;
         ts.preferredTabWidth = this.config.preferredTabWidth || 150;
         ts.monitorResize = false;
-        ts.bodyEl.setStyle("overflow", this.config.autoScroll ? "auto" : "hidden");
+        //ts.bodyEl.setStyle("overflow", this.config.autoScroll ? "auto" : "hidden"); // this is set in render?
         ts.bodyEl.addClass('roo-layout-tabs-body');
         this.panels.each(this.initPanelAsTab, this);
     },
@@ -32866,7 +33079,8 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
     initPanelAsTab : function(panel){
         var ti = this.tabs.addTab(
                     panel.getEl().id,
-                    panel.getTitle(), null,
+                    panel.getTitle(),
+                    null,
                     this.config.closeOnTab && panel.isClosable()
             );
         if(panel.tabTip !== undefined){
@@ -32973,20 +33187,33 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
      * @param {ContentPanel...} panel The ContentPanel(s) to add (you can pass more than one)
      * @return {Roo.ContentPanel} The panel added (if only one was added; null otherwise)
      */
-    add : function(panel){
+    add : function(panel)
+    {
         if(arguments.length > 1){
             for(var i = 0, len = arguments.length; i < len; i++) {
                 this.add(arguments[i]);
             }
             return null;
         }
+        
+        // if we have not been rendered yet, then we can not really do much of this..
+        if (!this.bodyEl) {
+            this.unrendered_panels.push(panel);
+            return panel;
+        }
+        
+        
+        
+        
         if(this.hasPanel(panel)){
             this.showPanel(panel);
             return panel;
         }
         panel.setRegion(this);
         this.panels.add(panel);
-        if(this.panels.getCount() == 1 && !this.config.alwaysShowTabs){
+       /* if(this.panels.getCount() == 1 && !this.config.alwaysShowTabs){
+            // sinle panel - no tab...?? would it not be better to render it with the tabs,
+            // and hide them... ???
             this.bodyEl.dom.appendChild(panel.getEl().dom);
             if(panel.background !== true){
                 this.setActivePanel(panel);
@@ -32994,6 +33221,7 @@ Roo.extend(Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Basic, {
             this.fireEvent("paneladded", this, panel);
             return panel;
         }
+        */
         if(!this.tabs){
             this.initTabs();
         }else{
@@ -34388,7 +34616,11 @@ Roo.extend(Roo.bootstrap.panel.Nest, Roo.bootstrap.panel.Content, {
         if(!this.ignoreResize(width, height)){
             var size = this.adjustForComponents(width, height);
             var el = this.layout.getEl();
-            el.setSize(size.width, size.height);
+            if (size.height < 1) {
+                el.setWidth(size.width);   
+            } else {
+                el.setSize(size.width, size.height);
+            }
             var touch = el.dom.offsetWidth;
             this.layout.layout();
             // ie requires a double layout on the first pass
@@ -34949,8 +35181,12 @@ Roo.extend(Roo.bootstrap.panel.Tabs, Roo.util.Observable, {
     createStripElements :  function(stripEl, text, closable)
     {
         var td = document.createElement("li"); // was td..
-        stripEl.insertBefore(td, stripEl.childNodes[stripEl.childNodes.length-1]);
-        //stripEl.appendChild(td);
+        
+        
+        //stripEl.insertBefore(td, stripEl.childNodes[stripEl.childNodes.length-1]);
+        
+        
+        stripEl.appendChild(td);
         /*if(closable){
             td.className = "x-tabs-closable";
             if(!this.closeTpl){