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
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