在numberfield extjs中仅允许正值

在numberfield extjs中仅允许正值,extjs,Extjs,如何在不使用验证器的情况下将numberfield中的值限制为仅为正值(不包括0) 用这个,它适合我 new Ext.form.NumberField({ id: 'port', fieldLabel: 'Port', name: 'port', allowNegative: false, allowBlank: false, minValue: 1, anchor: '90%', allowDecimals: false })

如何在不使用验证器的情况下将numberfield中的值限制为仅为正值(不包括0)

用这个,它适合我

new Ext.form.NumberField({
    id: 'port',
    fieldLabel: 'Port',
    name: 'port',
    allowNegative: false,
    allowBlank: false,
    minValue: 1,
    anchor: '90%',
    allowDecimals: false
})

如果您有
minValue:1
,则不需要
allowNegative:false
。这只有在你真的不想允许小数的情况下才有效。你的问题只有解决办法。最好的方法是使用验证器。其他不推荐的解决方案是将config设置为大于0的分数,或者您可以将自己的设置为忽略0作为有效输入,这比简单的验证器复杂得多。