From 186ca9fae55e3679de298305d51281d256fac089 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 26 Mar 2024 17:02:48 +0800 Subject: [PATCH] Changed docs/json/roodata.jsondocs/src/Roo_form_NumberField.js.htmldocs/symbols/Roo.form.NumberField.json --- docs/json/roodata.json | 8 ++++++++ docs/src/Roo_form_NumberField.js.html | 9 ++++++++- docs/symbols/Roo.form.NumberField.json | 24 ++++++++++++++++-------- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/json/roodata.json b/docs/json/roodata.json index 4dd59e3b78..c30dfd5eb3 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -243971,6 +243971,14 @@ "isOptional" : false, "optvals" : [] }, + { + "name" : "thousandSeparator", + "type" : "String", + "desc" : "Character(s) to allow as the thousand separator (defaults to '') - set to ',' for example", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, { "name" : "validateOnBlur", "type" : "Boolean", diff --git a/docs/src/Roo_form_NumberField.js.html b/docs/src/Roo_form_NumberField.js.html index c13cc3dde5..c22095adb9 100644 --- a/docs/src/Roo_form_NumberField.js.html +++ b/docs/src/Roo_form_NumberField.js.html @@ -35,6 +35,10 @@ * @cfg {String} decimalSeparator Character(s) to allow as the decimal separator (defaults to '.') */ decimalSeparator : ".", + /** + * @cfg {String} thousandSeparator Character(s) to allow as the thousand separator (defaults to '') - set to ',' for example + */ + thousandSeparator : "", /** * @cfg {Number} decimalPrecision The maximum precision to display after the decimal separator (defaults to 2) */ @@ -119,7 +123,7 @@ // private parseValue : function(value){ - value = parseFloat(String(value).replace(this.decimalSeparator, ".")); + value = parseFloat(String(value).replace(this.decimalSeparator, ".").replace(this.thousandSeparator, '')); return isNaN(value) ? '' : value; }, @@ -134,6 +138,9 @@ setValue : function(v){ v = this.fixPrecision(v); + if(this.thousandSeparator != ''){ + v = Roo.util.Format.number(v, this.decimalPrecision, this.thousandSeparator); + } Roo.form.NumberField.superclass.setValue.call(this, String(v).replace(".", this.decimalSeparator)); }, diff --git a/docs/symbols/Roo.form.NumberField.json b/docs/symbols/Roo.form.NumberField.json index f3265f0f01..aa13ed42b6 100644 --- a/docs/symbols/Roo.form.NumberField.json +++ b/docs/symbols/Roo.form.NumberField.json @@ -84,6 +84,14 @@ "isOptional" : false, "optvals" : [] }, + { + "name" : "thousandSeparator", + "type" : "String", + "desc" : "Character(s) to allow as the thousand separator (defaults to '') - set to ',' for example", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, { "name" : "nanText", "type" : "String", @@ -252,14 +260,6 @@ "isOptional" : false, "optvals" : [] }, - { - "name" : "validateOnBlur", - "type" : "Boolean", - "desc" : "Whether the field should validate when it loses focus (defaults to true).", - "memberOf" : "Roo.form.Field", - "isOptional" : false, - "optvals" : [] - }, { "name" : "cls", "type" : "String", @@ -276,6 +276,14 @@ "isOptional" : false, "optvals" : [] }, + { + "name" : "validateOnBlur", + "type" : "Boolean", + "desc" : "Whether the field should validate when it loses focus (defaults to true).", + "memberOf" : "Roo.form.Field", + "isOptional" : false, + "optvals" : [] + }, { "name" : "fieldClass", "type" : "String", -- 2.39.2