Ext.form.NumberField如何限制输入小数,只准输入整数
这样就可以了.
[code="java"] var n = new Ext.form.NumberField({
renderTo:Ext.getBody(),
allowDecimals:false
})[/code]
写个正则表达式去验证
decimalPrecision : Number
The maximum precision to display after the decimal separator (defaults to 2)
设置为0
Ext.form.NumberField自带配置项里面有
allowBlank: false,
allowDecimals: true, // 允许小数点
allowNegative: true, // 允许负数
allowNegative :true,
其中allowNegative默认为true,即默认允许为负数
你既然不要输入负数,设置allowDecimals:false就可以了。
LZ看下ext API就一目了然了。
allowDecimals:false
decimalPrecision:0