I’m using a very simple RadioGroup within a form. My form is filled-up with a record via the method form.loadRecord(), and later I update the record depending on the values in my form using form.updateRecord(). It works, I can load record and save them, no problem at this point.
The issues comes up when I want to check the dirty status of the form, using its method isDirty(). It’s ALWAYS ‘true’. I basically know why and that’s because the RadioGroup’s original value is always equal to “0”, and is not set by loadRecord() (it just apply the value on the adhoc radiogroup’s child).
-> form.getFields().items[10].originalValue
= Rating: “0”
-> form.getFields().items[10].getValue()
= Rating: “3”
I should add that NONE of the others fields are dirty (trackResetOnLoad is set on true on the form, that allows the form to be reset when a record is loaded). This issue happens only with the radiogroup.
Here is the code of the radiogroup I use. I tried to add “name: ‘Rating'” to the radiogroup but it crashes (apparently it was working in ExtJS 3.x).
xtype : 'radiogroup',
fieldLabel: 'Rating',
items: [
{
boxLabel : 'Zero',
name : 'Rating',
inputValue: "0"
}, {
boxLabel : 'One',
name : 'Rating',
inputValue: "1"
}, {
boxLabel : 'Two',
name : 'Rating',
inputValue: "3"
}
]
Thanks for your help!
This is just the behaviour of the form in general, obviously by default a form has no field values and when you load data it obviously changes and makes the form dirty.
When I’ve had to rely on the
isDirty()method I’ve reset the form field’s value manually…Ext.getCmp('fieldId').resetOriginalValue();Whilst this isn’t a fix, it should be ok as a temporary workaround. Looks like this could be a bug, may be worth posting on the Sencha forum