I have a form Item which contains RadioButtonGroup and a Repeater 
which dynamically loads up RadioButtons from model data, it is inside 
a VBox container:

<mx:FormItem direction="horizontal">
<mx:Label text="Status:"/>
<mx:RadioButtonGroup id="statusType" 
selectedValue="{model.selectedValuation.valuationAdmin.valuation_statu
s}"/>
<mx:Repeater id="valStatus" 
dataProvider="{listModel.allValuationStatuses}">
<mx:RadioButton id="vs" group="{statusType}" 
label="{valStatus.currentItem.title}"/>
</mx:Repeater>
</mx:FormItem>

On creationComplete() I call init() which in turn calls 
loadUserInfo(). Here I call selectedValStatus and pass on selected 
data from model:

private function loadUserInfo():void{
if(model.selectedValuation.valuation_administration != null){
selectedValStatus(model.selectedValuation.valuation_administration.val
uation_status);
}
}

selectedValStatus() takes the data object passed to it, loops over the 
model list data and then checks to see if the model list data is 
equivalent to the data.title property, where i then set the selected 
value of the radio group:

private function selectedValStatus(data:Object):void{
if(listModel.allValuationStatuses != null){
for(var i:int = 0; i<listModel.allValuationStatuses.length; i++){
var item:ArrayCollection = listModel.allValuationStatuses;
if(data != null){
if(item.title == data.title){
statusType.selectedValue = data.title;
}
}
}
}
}

The Behavior:
Data is present on creation complete.
I have another radio group using the same code architecture that works 
perfectly, is in same form.
On the form load the radio button is not selected.
On a view index change and then return the button is selected 
properly.
Thanks! 

Reply via email to