X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/src/widgets/form/NumberField.js diff --git a/src/widgets/form/NumberField.js b/src/widgets/form/NumberField.js index 1325d5bf..c6cd3482 100644 --- a/src/widgets/form/NumberField.js +++ b/src/widgets/form/NumberField.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.0.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -109,10 +109,26 @@ Ext.form.NumberField = Ext.extend(Ext.form.TextField, { }, setValue : function(v){ - v = typeof v == 'number' ? v : parseFloat(String(v).replace(this.decimalSeparator, ".")); + v = Ext.isNumber(v) ? v : parseFloat(String(v).replace(this.decimalSeparator, ".")); v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator); return Ext.form.NumberField.superclass.setValue.call(this, v); }, + + /** + * Replaces any existing {@link #minValue} with the new value. + * @param {Number} value The minimum value + */ + setMinValue : function(value){ + this.minValue = Ext.num(value, Number.NEGATIVE_INFINITY); + }, + + /** + * Replaces any existing {@link #maxValue} with the new value. + * @param {Number} value The maximum value + */ + setMaxValue : function(value){ + this.maxValue = Ext.num(value, Number.MAX_VALUE); + }, // private parseValue : function(value){