X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs%2Fsymbols%2Fsrc%2FRoo_bootstrap_MoneyField.js.html;h=3009b6b0fac936eef59afc866ed7c9b4646c4f98;hb=7d8290ee43eec264e8d9276b83debe3a035cb929;hp=6c479bfab760039170a5c34ec7bddcb7ee6d08d0;hpb=2a1db797ae4360623f7e3ac751623317dada79f1;p=roojs1 diff --git a/docs/symbols/src/Roo_bootstrap_MoneyField.js.html b/docs/symbols/src/Roo_bootstrap_MoneyField.js.html index 6c479bfab7..3009b6b0fa 100644 --- a/docs/symbols/src/Roo_bootstrap_MoneyField.js.html +++ b/docs/symbols/src/Roo_bootstrap_MoneyField.js.html @@ -28,7 +28,7 @@ /** * @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) */ @@ -58,6 +58,16 @@ * @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, + /** + * @cfg {String} thousandsDelimiter Symbol of thousandsDelimiter + */ + thousandsDelimiter : false, + inputlg : 9, inputmd : 9, @@ -84,8 +94,15 @@ 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) { @@ -214,9 +231,10 @@ cfg.cn = [ label, - container + container, + hiddenInput ]; - + var settings = this; ['xs','sm','md','lg'].map(function(size){ @@ -226,7 +244,6 @@ }); return cfg; - }, initEvents : function() @@ -236,7 +253,6 @@ this.initCurrencyEvent(); this.initNumberEvent(); - }, initCurrencyEvent : function() @@ -479,6 +495,12 @@ this.lastSelectionText = currency; + //setting default currency + if(o[this.currencyField] * 1 == 0 && this.defaultCurrency) { + this.setCurrency(this.defaultCurrency); + return; + } + this.setCurrency(currency); }, @@ -521,7 +543,17 @@ 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(); } }, @@ -617,7 +649,7 @@ var v = this.parseValue(this.getRawValue()); - if(v){ + if(v || v == 0){ this.setValue(v); } }, @@ -653,6 +685,11 @@ 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