X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs%2Fsymbols%2Fsrc%2FRoo_bootstrap_NumberField.js.html;h=f9ef21b13dff58c8be73c9125061d76a321a3b3a;hb=f75782c347f3d8c26acf0c63fa08a09d77539344;hp=ad7299f8bf7e245e61dd4a0723be12bb101fc8d9;hpb=1f29758cfb4b45fba97b827fa53dad9e5b036281;p=roojs1 diff --git a/docs/symbols/src/Roo_bootstrap_NumberField.js.html b/docs/symbols/src/Roo_bootstrap_NumberField.js.html index ad7299f8bf..f9ef21b13d 100644 --- a/docs/symbols/src/Roo_bootstrap_NumberField.js.html +++ b/docs/symbols/src/Roo_bootstrap_NumberField.js.html @@ -61,6 +61,10 @@ * if a valid character like '.' or '-' is left in the field with no number (defaults to "{value} is not a valid number") */ nanText : "{0} is not a valid number", + /** + * @cfg {Boolean} castInt (true|false) cast int if true (defalut true) + */ + castInt : true, // private initEvents : function() @@ -80,13 +84,22 @@ this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi'); var keyPress = function(e){ + var k = e.getKey(); - if(!Roo.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){ + var c = e.getCharCode(); + + if( + (String.fromCharCode(c) == '.' || String.fromCharCode(c) == '-') && + allowed.indexOf(String.fromCharCode(c)) === -1 + ){ + e.stopEvent(); return; } - var c = e.getCharCode(); + if(!Roo.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){ + return; + } if(allowed.indexOf(String.fromCharCode(c)) === -1){ e.stopEvent(); @@ -157,6 +170,10 @@ beforeBlur : function() { + if(!this.castInt){ + return; + } + var v = this.parseValue(this.getRawValue()); if(v){ this.setValue(v);