-
2 Jul 2012 6:42 AM #1
Ext.form.field.Number change min/max Value doesn't reset maskRe
Ext.form.field.Number change min/max Value doesn't reset maskRe
Ext version tested:
- Ext 4.1.0
- Chrome v20 (Windows)
- The maskRe for Number fields is only set on initComponent and is never checked again. There are public methods exposed to control the minValue and maxValue for the field but they don't re-evaluate the maskRe.
- Create a number field where minValue = 0 and maxValue = Number.Max_Value (Only positive numbers)
- Notice that you CAN'T type in a negative sign. This is correct.
- After it has been rendered, programatically set the minValue = -Number.Max_Value and the maxValue = -Number.Min_Value (Only negative numbers)
- Notice that you still CAN'T type in a negative sign. This is incorrect.
- You should be able to key in negative numbers
- You can't enter the negative sign because of the maskRe assigned previously.
Code:initComponent: function () { var me = this, allowed; me.callParent(); me.setMinValue(me.minValue); me.setMaxValue(me.maxValue); // Build regexes for masking and stripping based on the configured options if (me.disableKeyFilter !== true) { allowed = me.baseChars + ''; if (me.allowDecimals) { allowed += me.decimalSeparator; } if (me.minValue < 0) { allowed += '-'; } allowed = Ext.String.escapeRegex(allowed); me.maskRe = new RegExp('[' + allowed + ']'); if (me.autoStripChars) { me.stripCharsRe = new RegExp('[^' + allowed + ']', 'gi'); } } },
Possible fix:- Change the setMinValue and setMaxValue to re-create the mask or make the maskRe not private?
- Win7 Pro 64bit
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-6711
in
4.1.2.


Reply With Quote