PDA

View Full Version : [FIXED-1414] NumberField setValue fails using custom decimalSeparator



maciasoft
26 Nov 2010, 4:32 PM
Ext version tested:

Ext 3.3.0


Description:

NumberField's setValue first fixes precision and then parses custom decimal separator, which is causing errors.


Test Case:



var nf = new Ext.NumberField({decimalSeparator: ','});
nf.setValue('10,0'); //fails, and is often used internaly by Extjs e.g. this.setValue(this.value) after render


Possible fix:


setValue : function(v) {
//v = this.fixPrecision(v); REMOVE THIS LINE
v = Ext.isNumber(v) ? v : parseFloat(String(v).replace(this.decimalSeparator, "."));
v = this.fixPrecision(v); // AND PLACE IT HERE
v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator);
return Ext.form.NumberField.superclass.setValue.call(this, v);
}

meroy
4 Dec 2010, 1:55 AM
Thanks for the report. This has been fixed in SVN.