PDA

View Full Version : RadioGroup(/Radio) component and form.loadRecord functionality



emilianm
21 Aug 2011, 10:54 PM
It seems that we encountered a issue with RadioGroup(/Radio) components.
When you design a form you can put any kind of fields and on a later time you can use form.loadRecord(Ext.data.Model record) to populate the entire form.

This works as expected, excepting the RadiGroup component. If you would like to display the selected Radio when the loadRecord is called with the appropriate values you will discovered that this is not working. You have to relay on the checked property of the Radio component, and to set this manually. This implies an additional asynchronous action after your initial model was loaded.

If you decide to "render" the data associated with the radioGroup with a different ExtJs 4 component, for example with a plain textfield or with a combobox, everything will work fine after you call form.loadRecord(Ext.data.Model record) and you will have you data directly pre-selected on the screen .

If you have any solution for this or any comments please do not hesitate to reply.
Thanks!

Dr. Flink
13 Feb 2012, 4:45 AM
+1
Has anyone got this to work as intended?

ValterBorges
16 Feb 2012, 9:01 PM
loadRecord on radiogroup works in 4.0.7.

However, If the name/id of the group and elements is not correct it will not load.

The name of the elements has to match the name of the field in the record.
The name of the elements must not be the same as the radiogroup id.
The radiogroup cannot contain the name element.

I'm having an issue with trackResetOnLoad:true and loadRecord(record) and reset() clearing the radio button. There are some mention of these issues in 3.x reports is anyone having this issue?

nani1216
23 Feb 2012, 12:23 AM
{ "data" :
[ { "userName" : "Nani1216" },
{ "id" : "RadioGroupName",
"value" :
{ "RadioGroupName" : "inputValue" }
},
{ "id" : "RadioGroupName2",
"value" :
{ "RadioGroupName2" : "inputValue" }
}
],"success" : true }

If i use the above format and the form contains only radiogroup component and no other fields, the radio fields are get selected in form load action.

If a form contains radiogroup and other fields, only radiogroup data is loaded in to the form and remaining fields are not loaded with data.



{ "data" : { "userName" : "Nani1216" },
{ "id" : "RadioGroupName",
"value" :
{ "RadioGroupName" : "inputValue" }
},
{ "id" : "RadioGroupName2",
"value" :
{ "RadioGroupName2" : "inputValue" }
}
,"success" : true }

Above format loads the "userName" textfield and radiogroup values not selected.
Notice the difference is only square brackets ( [ ] )