0 Replies Latest reply on Aug 21, 2007 2:09 AM by ausaran007

    radiobutton inside a datagrid

    ausaran007
      Hi all,
      I have a radioButton for every element inside a datagrid. The problem is all radiobuttons get selected because of this and the behaviour is more like a checkbox rather than a radioButton. Any idea how to solve this?

      I tried by writing a method like this. Here CPRadioButton is the name of the RadioButtonGroup.

      public function resetOther():void {
      var lengthOfDataGrid:int = 3;
      for (var i:int=0; i<lengthOfDataGrid;i++) {
      var radioButton:RadioButton = CPRadioButton.getRadioButtonAt(i);
      if(radioButton.selected) {
      radioButton.selected = false;
      }
      }
      }

      Here I am getting a null object for CPRadioButton. Why is it so?

      My mxml looks like this.

      <mx:RadioButtonGroup id="CPRadioButton"/>
      <mx:DataGrid id="creditPolicyGrid" dataProvider="{model.creditPolicyCollection}"
      width="572" height="274" >
      <mx:columns>

      <mx:DataGridColumn width="25">
      <mx:itemRenderer>
      <mx:Component>
      <mx:Box>
      <mx:RadioButton groupName="{parentDocument.CPRadioButton}" click="parentDocument.resetOther()"/>
      </mx:Box>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>