roojs-all.js
[roojs1] / roojs-bootstrap-debug.js
index f4d6f2a..38e367c 100644 (file)
@@ -241,11 +241,17 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
         var has_flexy = (typeof(tree['flexy:if']) != 'undefined') ||
                     (typeof(tree['flexy:foreach']) != 'undefined');
           
+    
         
-        
-         skip_children = false;
+        skip_children = false;
         // render the element if it's not BODY.
         if (!is_body) {
+            
+            // if parent was disabled, then do not try and create the children..
+            if(!this[cntr](true)){
+                tree.items = [];
+                return tree;
+            }
            
             cn = Roo.factory(tree);
            
@@ -308,12 +314,18 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
                 //Roo.log('render');
                 //Roo.log(this[cntr]());
                 // some elements do not have render methods.. like the layouts...
+                /*
+                if(this[cntr](true) === false){
+                    cn.items = [];
+                    return cn;
+                }
+                */
                 cn.render && cn.render(this[cntr](true));
+                
              }
             // then add the element..
         }
-        
-        
+         
         // handle the kids..
         
         var nitems = [];
@@ -6119,6 +6131,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         this.mainBody.on('scroll', this.onBodyScroll, this);
         
+        this.cm.on("headerchange", this.onHeaderChange, this);
         
     },
     
@@ -6849,10 +6862,12 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     onBodyScroll: function()
     {
         //Roo.log("body scrolled');" + this.mainBody.dom.scrollLeft);
-        this.mainHead.setStyle({
-            'position' : 'relative',
-            'left': (-1* this.mainBody.dom.scrollLeft) + 'px'
-        });
+        if(this.mainHead){
+            this.mainHead.setStyle({
+                'position' : 'relative',
+                'left': (-1* this.mainBody.dom.scrollLeft) + 'px'
+            });
+        }
         
         if(this.lazyLoad){
             
@@ -6879,7 +6894,18 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             }
             
         }
+    },
+    
+    onHeaderChange : function()
+    {
+        
+        var header = this.renderHeader();
+        var table = this.el.select('table', true).first();
+        
+        this.mainHead.remove();
+        this.mainHead = table.createChild(header, this.mainBody, false);
     }
+    
 });
 
  
@@ -7774,9 +7800,17 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
         this.activeAction = null;
         var o = action.options;
 
+        if(this.loadMask){
+            
+            if(this.maskBody){
+                Roo.get(document.body).unmask();
+            } else {
+                this.el.unmask();
+            }
+        }
+        
         //if(this.waitMsgTarget === true){
-            Roo.get(document.body).unmask();
-            this.el.unmask();
+//            this.el.unmask();
         //}else if(this.waitMsgTarget){
         //    this.waitMsgTarget.unmask();
         //}else{
@@ -8029,8 +8063,6 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
            f.clearInvalid();
         });
 
-
-
         return this;
     },
 
@@ -9236,7 +9268,12 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
         if(feedback){
             this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
         }
-
+        
+        if(this.indicator){
+            this.indicator.removeClass('visible');
+            this.indicator.addClass('invisible');
+        }
+        
         if(this.disabled){
             return;
         }
@@ -9245,11 +9282,6 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
             return;
         }
         
-        if(this.indicator){
-            this.indicator.removeClass('visible');
-            this.indicator.addClass('invisible');
-        }
-        
         this.el.addClass(this.validClass);
         
         if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank && (this.getValue().length || this.forceFeedback)){
@@ -9373,20 +9405,31 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
             return;
         }
         
-        this.fieldLabel = v;
-        
         if(this.indicator){
             var ar = this.el.select('label > span',true);
-            if (!ar.elements.length) {
-                Roo.log("could not find label > span on element");
-                Roo.log(this);
+            
+            if (ar.elements.length) {
+                this.el.select('label > span',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+                this.fieldLabel = v;
                 return;
             }
-            this.el.select('label > span',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+            
+            var br = this.el.select('label',true);
+            
+            if(br.elements.length) {
+                this.el.select('label',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+                this.fieldLabel = v;
+                return;
+            }
+            
+            Roo.log('Cannot Found any of label > span || label in input');
             return;
         }
         
         this.el.select('label',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+        this.fieldLabel = v;
+        
+        
     }
 });
 
@@ -13943,6 +13986,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
     onEmptyResults : function(){
         
         if(this.tickable && this.editable){
+            this.hasFocus = false;
             this.restrictHeight();
             return;
         }
@@ -20747,6 +20791,15 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         this.disabled = false;
         this.fireEvent("enable", this);
         return this;
+    },
+    
+    setBoxLabel : function(v)
+    {
+        this.boxLabel = v;
+        
+        if(this.rendered){
+            this.el.select('label.box-label',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+        }
     }
 
 });
@@ -32983,6 +33036,40 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
      * @cfg {Boolean} castInt (true|false) cast int if true (defalut true)
      */
     castInt : true,
+    /**
+     * @cfg {String} thousandsDelimiter Symbol of thousandsDelimiter
+     */
+    thousandsDelimiter : false,
+    /**
+     * @cfg {String} valueAlign alignment of value
+     */
+    valueAlign : "left",
+
+    getAutoCreate : function()
+    {
+        var hiddenInput = {
+            tag: 'input',
+            type: 'hidden',
+            id: Roo.id(),
+            cls: 'hidden-number-input'
+        };
+        
+        if (this.name) {
+            hiddenInput.name = this.name;
+        }
+        
+        this.name = '';
+        
+        var cfg = Roo.bootstrap.NumberField.superclass.getAutoCreate.call(this);
+        
+        this.name = hiddenInput.name;
+        
+        if(cfg.cn.length > 0) {
+            cfg.cn.push(hiddenInput);
+        }
+        
+        return cfg;
+    },
 
     // private
     initEvents : function()
@@ -32999,6 +33086,10 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
             allowed += "-";
         }
         
+        if(this.thousandsDelimiter) {
+            allowed += ",";
+        }
+        
         this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
         
         var keyPress = function(e){
@@ -33056,17 +33147,31 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
 
     getValue : function()
     {
-        return this.fixPrecision(this.parseValue(Roo.bootstrap.NumberField.superclass.getValue.call(this)));
+        var v = this.hiddenEl().getValue();
+        
+        return this.fixPrecision(this.parseValue(v));
     },
 
     parseValue : function(value)
     {
+        if(this.thousandsDelimiter) {
+            value += "";
+            r = new RegExp(",", "g");
+            value = value.replace(r, "");
+        }
+        
         value = parseFloat(String(value).replace(this.decimalSeparator, "."));
         return isNaN(value) ? '' : value;
     },
 
     fixPrecision : function(value)
     {
+        if(this.thousandsDelimiter) {
+            value += "";
+            r = new RegExp(",", "g");
+            value = value.replace(r, "");
+        }
+        
         var nan = isNaN(value);
         
         if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
@@ -33077,8 +33182,20 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
 
     setValue : function(v)
     {
-        v = this.fixPrecision(v);
-        Roo.bootstrap.NumberField.superclass.setValue.call(this, String(v).replace(".", this.decimalSeparator));
+        v = String(this.fixPrecision(v)).replace(".", this.decimalSeparator);
+        
+        this.value = v;
+        
+        if(this.rendered){
+            
+            this.hiddenEl().dom.value = (v === null || v === undefined ? '' : v);
+            
+            this.inputEl().dom.value = Roo.util.Format.number(v, this.decimalPrecision, 
+                this.thousandsDelimiter || ''
+            );
+            
+            this.validate();
+        }
     },
 
     decimalPrecisionFcn : function(v)
@@ -33096,6 +33213,11 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
         if(v){
             this.setValue(v);
         }
+    },
+    
+    hiddenEl : function()
+    {
+        return this.el.select('input.hidden-number-input',true).first();
     }
     
 });
@@ -33558,9 +33680,11 @@ Roo.extend(Roo.bootstrap.RadioSet, Roo.bootstrap.Input,  {
         }
         
         Roo.each(this.radioes, function(i){
-            
             i.checked = false;
             i.el.removeClass('checked');
+        });
+        
+        Roo.each(this.radioes, function(i){
             
             if(i.value === v || i.value.toString() === v.toString()){
                 i.checked = true;
@@ -33569,6 +33693,8 @@ Roo.extend(Roo.bootstrap.RadioSet, Roo.bootstrap.Input,  {
                 if(suppressEvent !== true){
                     this.fireEvent('check', this, i);
                 }
+                
+                return false;
             }
             
         }, this);
@@ -39932,6 +40058,12 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
      * @cfg {Boolean} castInt (true|false) cast int if true (defalut true)
      */
     castInt : true,
+    /**
+     * @cfg {String} defaults currency of the MoneyField
+     * value should be in lkey
+     */
+    defaultCurrency : false,
+    
     
     inputlg : 9,
     inputmd : 9,
@@ -40353,6 +40485,12 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
         
         this.lastSelectionText = currency;
         
+        //setting default currency
+        if(o[this.currencyField] * 1 == 0 && this.defaultCurrency) {
+            this.setCurrency(this.defaultCurrency);
+            return;
+        }
+        
         this.setCurrency(currency);
     },