Ryan Duval
Ryan Duval

Reputation:

Dynamic RadioButtons

Our resident Flex expert is out for the day and I thought this would be a good chance to test this site out. I have a dropdown with a dataProvider that is working fine:

<ep:ComboBox id="dead_reason" selectedValue="{_data.dead_reason}"
    dataProvider="{_data.staticData.dead_reason}"
    labelField="@label" width="300"/>

The ComboBox is custom but I'm not sure if that matters for the question. I need to change the combo box to radios (all in one group) but maintain the dynamic options. In other words, what is the best way to generate dynamic RadioButtons?

Upvotes: 0

Views: 804

Answers (2)

Kevin
Kevin

Reputation: 23634

<mx:RadioButtonGroup id="RDO_Group"/>
<mx:Repeater id="myRepeater" dataProvider="{_data.staticData.dead_reason}">
<mx:RadioButton id="rdo" label="{myRepeater.currentItem}" value="{myRepeater.currentItem}" groupName="RDO_Group"/>
</mx:Repeater>

is the best way.

Upvotes: 0

bill d
bill d

Reputation: 618

Try using an <mx:Repeater> Something like:

<mx:Repeater dataProvider="{_data.staticData.dead_reason}">
   <mx:RadioButton groupName="reasons" ...>
</mx:Repeater>

Upvotes: 3

Related Questions