roojs-core.js
[roojs1] / roojs-bootstrap-debug.js
index 031ab55..858b5aa 100644 (file)
@@ -6862,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){
             
@@ -6896,14 +6898,14 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     
     onHeaderChange : function()
     {
-        this.updateHeaders.apply(this, arguments);
-    }, 
-    
-    updateHeaders : function()
-    {
-        var html = this.renderHeader();
-//        this.mainHead.update(html);
+        
+        var header = this.renderHeader();
+        var table = this.el.select('table', true).first();
+        
+        this.mainHead.remove();
+        this.mainHead = table.createChild(header, this.mainBody, false);
     }
+    
 });
 
  
@@ -7555,6 +7557,7 @@ Roo.form.Action.ACTION_TYPES = {
 
 
 Roo.bootstrap.Form = function(config){
+    
     Roo.bootstrap.Form.superclass.constructor.call(this, config);
     
     Roo.bootstrap.Form.popover.apply();
@@ -7589,7 +7592,6 @@ Roo.bootstrap.Form = function(config){
          */
         actioncomplete : true
     });
-
 };
 
 Roo.extend(Roo.bootstrap.Form, Roo.bootstrap.Component,  {
@@ -8061,8 +8063,6 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
            f.clearInvalid();
         });
 
-
-
         return this;
     },
 
@@ -8099,13 +8099,10 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             Roo.each(el.items,function(e) {
                 iter(e);
             });
-
-
         };
 
         iter(this);
         return r;
-        
     }
 
 });
@@ -24439,7 +24436,8 @@ Roo.extend(Roo.bootstrap.PagingToolbar, Roo.bootstrap.NavSimplebar, {
     // private
     onLoad : function(ds, r, o)
     {
-        this.cursor = o.params ? o.params.start : 0;
+        this.cursor = o.params.start ? o.params.start : 0;
+        
         var d = this.getPageData(),
             ap = d.activePage,
             ps = d.pages;
@@ -33036,6 +33034,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()
@@ -33052,6 +33084,10 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
             allowed += "-";
         }
         
+        if(this.thousandsDelimiter) {
+            allowed += ",";
+        }
+        
         this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
         
         var keyPress = function(e){
@@ -33109,17 +33145,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){
@@ -33130,8 +33180,24 @@ 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 || ''
+            );
+            
+            if(this.allowBlank && !v) {
+                this.inputEl().dom.value = '';
+            }
+            
+            this.validate();
+        }
     },
 
     decimalPrecisionFcn : function(v)
@@ -33149,6 +33215,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();
     }
     
 });
@@ -33611,9 +33682,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;
@@ -33622,6 +33695,8 @@ Roo.extend(Roo.bootstrap.RadioSet, Roo.bootstrap.Input,  {
                 if(suppressEvent !== true){
                     this.fireEvent('check', this, i);
                 }
+                
+                return false;
             }
             
         }, this);
@@ -39955,7 +40030,7 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
     /**
      * @cfg {Number} decimalPrecision The maximum precision to display after the decimal separator (defaults to 2)
      */
-    decimalPrecision : 2,
+    decimalPrecision : 0,
     /**
      * @cfg {Boolean} allowNegative False to prevent entering a negative sign (defaults to true)
      */
@@ -39990,6 +40065,10 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
      * value should be in lkey
      */
     defaultCurrency : false,
+    /**
+     * @cfg {String} thousandsDelimiter Symbol of thousandsDelimiter
+     */
+    thousandsDelimiter : false,
     
     
     inputlg : 9,
@@ -40017,8 +40096,15 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
             autocomplete: 'new-password'
         };
         
+        var hiddenInput = {
+            tag: 'input',
+            type: 'hidden',
+            id: Roo.id(),
+            cls: 'hidden-number-input'
+        };
+        
         if (this.name) {
-            input.name = this.name;
+            hiddenInput.name = this.name;
         }
 
         if (this.disabled) {
@@ -40147,9 +40233,10 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
 
         cfg.cn = [
             label,
-            container
+            container,
+            hiddenInput
         ];
-
+        
         var settings = this;
 
         ['xs','sm','md','lg'].map(function(size){
@@ -40159,7 +40246,6 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
         });
         
         return cfg;
-        
     },
     
     initEvents : function()
@@ -40169,7 +40255,6 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
         this.initCurrencyEvent();
         
         this.initNumberEvent();
-        
     },
     
     initCurrencyEvent : function()
@@ -40460,7 +40545,17 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
         this.value = v;
         
         if(this.rendered){
-            this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+            
+            this.hiddenEl().dom.value = (v === null || v === undefined ? '' : v);
+            
+            this.inputEl().dom.value = Roo.util.Format.number(v, this.decimalPrecision, 
+                this.thousandsDelimiter || ','
+            );
+            
+            if(this.allowBlank && !v) {
+                this.inputEl().dom.value = '';
+            }
+            
             this.validate();
         }
     },
@@ -40592,6 +40687,11 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
     currencyEl : function()
     {
         return this.el.select('.roo-money-currency-input', true).first();
+    },
+    
+    hiddenEl : function()
+    {
+        return this.el.select('input.hidden-number-input',true).first();
     }
     
 });
\ No newline at end of file