PDA

View Full Version : Ext.ux.Spinner Spins while disabled



dblak90
5 Nov 2009, 2:07 PM
I noticed that while the SpinnerField is disabled the spinner arrows still altered the field value.

Here are the three changes I implemented in Ext.ux.Spinner to prevent this bug.

doEnable


doEnable: function(){

if (this.wrap) {
this.wrap.removeClass(this.field.disabledClass);
}
this.disabled = false;
},




doDisable


doDisable: function(){

if (this.wrap) {
this.wrap.addClass(this.field.disabledClass);
this.el.removeClass(this.field.disabledClass);
}
this.disabled = true;
},



isSpinnable


isSpinnable: function(){

if (this.disabled || this.el.dom.readOnly || this.field.disabled) {
Ext.EventObject.preventDefault(); //prevent scrolling when disabled/readonly
return false;
}
return true;
},



I know that the last change in the isSpinnable function is a bit of overkill when the first two changes are implemented...However, I thought it would be better to be safe than sorry. :D

Gadbury
7 Nov 2009, 5:45 AM
Many thanks for this.

Trey
23 Apr 2010, 7:12 AM
Hi,
I have the same problem with spinner. Events are fired when spinner is disabled.
Is it possible to update the code with dblak90 fix ?