将异常添加到numberfield extjs 3中的最小/最大值

将异常添加到numberfield extjs 3中的最小/最大值,extjs,extjs4,extjs3,Extjs,Extjs4,Extjs3,像这样的数字域 xtype : 'numberfield', fieldLabel : 'this is a label', id : 'id', name : 'id', width : 50, labelStyle : 'width:300px', minValue : 1, hideTrigger : true, allowNegative

像这样的数字域

xtype            : 'numberfield',  
fieldLabel       : 'this is a label',
id               : 'id',
name             : 'id', 
width            : 50,
labelStyle       : 'width:300px',
minValue         : 1,
hideTrigger      : true,
allowNegative    : false,
maxValue         : 7,
decimalPrecision : 1,
allowPureDecimal : true,
editable         : true,   
allowBlank       : false
接受数字1,1.1,3.5。。。七,

但是我需要也接受0。extjs中是否存在类似exception的属性或允许输入0以及所建立的最小值和最大值的内容

如果有人能指导我,我将不胜感激


谢谢你的时间

我认为没有这样做的属性,但是您可以注册一个更改侦听器,并检查newValue参数是否介于0和1之间。如果是,请将numberfield的值设置为零

listeners: {
    change: function (component, newValue, oldValue) {
        if (newValue > 0 && newValue < 1)
            component.setValue(0);
    }
}
侦听器:{
更改:函数(组件、新值、旧值){
if(newValue>0&&newValue<1)
组件设置值(0);
}
}

我认为没有这样做的属性,但是您可以注册一个更改侦听器,并检查newValue参数是否介于0和1之间。如果是,请将numberfield的值设置为零

listeners: {
    change: function (component, newValue, oldValue) {
        if (newValue > 0 && newValue < 1)
            component.setValue(0);
    }
}
侦听器:{
更改:函数(组件、新值、旧值){
if(newValue>0&&newValue<1)
组件设置值(0);
}
}

删除
minValue
maxValue
配置,然后使用配置设置自定义验证功能

xtype:'numberfield',
fieldLabel:“这是一个标签”,
id:'id',
名称:“id”,
希德崔格:没错,
allowNegative:false,
精度:1,
allowPureDecimal:对,
是的,
allowBlank:false,
验证器(){
value=this.getValue();

如果(value==0 | |(value>=1&&value删除
minValue
maxValue
配置,然后使用配置设置自定义验证函数

xtype:'numberfield',
fieldLabel:“这是一个标签”,
id:'id',
名称:“id”,
希德崔格:没错,
allowNegative:false,
精度:1,
allowPureDecimal:对,
是的,
allowBlank:false,
验证器(){
value=this.getValue();

如果(value===0 | |(value>=1&&value)minValue:0不起作用吗?是的,但我不需要值0.1-0.2-0.9和minValue 0接受该数字minValue:0不起作用吗?是的,但我不需要值0.1-0.2-0.9和minValue 0接受该数字