2 Replies Latest reply on May 26, 2011 8:29 PM by NoMan'sLand

    Radiobutton Group in Datagrid

      I have a datagrid with a radiobutton group in a column. I would like to make radiobuttons within the group visible or not based on their value.

      <mx:DataGridColumn headerText="Best 3 Historic Matches Based on POS" dataField="historic_end_date" rendererIsEditor="true" editorDataField="text" editable="true" width="300">
      <mx:VBox left="5">
      import mx.core.Application;
      public var text:String;
      <mx:RadioButtonGroup id="week" selectedValue="{data.historic_end_date}" change="text=week.selectedValue.toString()"/>
      <mx:RadioButton id="rbWeek1" groupName="week" value="{data.week1_start}" label="{data.week1_start} - {data.week1_end} ({data.week1_pos})"/>
      <mx:RadioButton id="rbWeek2" groupName="week" value="{data.week2_start}" label="{data.week2_start} - {data.week2_end} ({data.week2_pos})"/>
      <mx:RadioButton id="rbWeek3" groupName="week" value="{data.week3_start}" label="{data.week3_start} - {data.week3_end} ({data.week3_pos})"/>

      If {data.week1_start} = "No Data", I would like to set rbWeek1.visible="false"

      Any ideas?

        • 1. Re: Radiobutton Group in Datagrid
          Possibly the easiest would be to bind the 'visible' property to an implicit Boolean on your Array Collection. Add a method like this to your ActionScript class:

          public function get week1Enabled():Boolean {
          if( data.week1_start == "No Data")
          return false

          return true

          then for your RadioButton, simply add the following two properties:


          You need to add 'includeInLayout' because otherwise, you'll get a blank spot where your radio button normally is. You'll have to add a getter like this for each button, but otherwise, it should do what you want it to.

          Hope this helps!
          • 2. Re: Radiobutton Group in Datagrid
            NoMan'sLand Level 1


                <s:RadioButtonGroup id="rbtnGroup"/>


                    <mx:DataGridColumn headerText="A" dataField="a">
                                <mx:HBox horizontalAlign="center" width="100%">
                                    <s:RadioButton group="{outerDocument.rbtnGroup}" />