PDA

View Full Version : How to override spindown event in numberfield



conderol
27 Sep 2012, 5:51 AM
Hi. I am on Ext 4.
I have a grid with numberfield. How to override spindown event on numberfield. My purpose it when user clicks keydown,
instead of reducing the numeric value currently I see in the field,
next row in the grid will become selected. I was able to implement moving to the next row in the grid with key events, but cannot make spinner
stop reducing the field value

scottmartin
27 Sep 2012, 6:15 AM
Have a look at the follow:



Ext.override(Ext.form.field.Number, {

onSpinDown: function() {
var me = this;

if (!me.readOnly) {
me.setSpinValue(Ext.Number.constrain(me.getValue() - me.step, me.minValue, me.maxValue));
}
},

setSpinValue: function(value) {
var me = this,
len;

if (me.enforceMaxLength) {


if (me.fixPrecision(value).toString().length > me.maxLength) {
return;
}
}
me.setValue(value);
}
});


Simply modify the code to fit your needs.

Scott.