1 Reply Latest reply: Jul 19, 2013 6:41 AM by Craberoid RSS

    need three radio buttons in three different columns of a data grid acting as part of a group.

    gaurav97

      Also they must retrieve and update their selected values to an arraycollection !

        • 1. Re: need three radio buttons in three different columns of a data grid acting as part of a group.
          Craberoid Community Member

          You can create a different itemRenderer for columns, that will be include RadioButton.

          It will be look something like that:

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"

                                                            xmlns:s="library://ns.adobe.com/flex/spark"

                                                            xmlns:mx="library://ns.adobe.com/flex/mx" clipAndEnableScrolling="true">

                    <fx:Script>

                              <![CDATA[

           

                                        override public function set data(value:Object):void

                                        {

                                                  super.data = value;

           

                                                  if (value)

                                                  {

                                                            radio.selected = Boolean(value.someData);

                                                            radio.groupName = "radioGroup" + this.rowIndex;

                                                  }

           

                                        }

           

                                        protected function radio_changeHandler(event:Event):void

                                        {

                                                  // TODO Auto-generated method stub

                                                  data.someData = radio.selected;

                                        }

           

                              ]]>

                    </fx:Script>

           

                    <s:RadioButton id="radio" change="radio_changeHandler(event)" />

           

          </s:GridItemRenderer>

           

          And all radiobuttons in each row will work in separatly group.