PDA

View Full Version : [FIXED][2.2.1/3.0rc2] Ext.form.Checkbox - initValue



harley.333
23 Feb 2009, 1:30 PM
Is there a reason the initValue method of the Ext.form.Checkbox class is set to Ext.emptyFn? Doing this means that initValue no longer resets the "dirty flag" on checkboxes.

To Reproduce:
1. Make a checkbox.
2. isDirty() returns false
3. check the checkbox
4. isDirty() returns true
5. call checkbox.initValue()
6. isDirty() still returns true

I'm using the following work-around:

Ext.override(Ext.form.Checkbox, {
initValue: function() {
this.originalValue = this.checked;
}
});

tryanDLS
23 Feb 2009, 2:27 PM
Not sure what the reasoning was, but that's not a new change - been that way since at least 1.1.1.

Maybe somebody else will chime in with the thought behind it.

Condor
23 Feb 2009, 10:39 PM
checkbox.initValue has been emptyFn since Ext 1.0, but setting the originalValue in initValue was introduced in Ext 2.2 and checkbox.initValue wasn't correct for this.

IMHO the override should be:

Ext.override(Ext.form.Checkbox, {
initValue: function() {
this.originalValue = this.getValue();
}
});

harley.333
24 Feb 2009, 5:55 PM
thanks condor

yroman
10 Jun 2009, 2:24 AM
Hi. It appears, that version 3.0 rc2 still has the problem. Does the lack of fix mean that such behavior is special ? Or can I apply fix myself ?

Such fix is essential for me because it is necessary to restore initial check box state after reset in my situation.

Thank you!

Condor
13 Jun 2009, 5:54 AM
Moving this thread to the 3.0 Bugs section...

evant
16 Jun 2009, 4:40 AM
Fixed in SVN, both branches.