This is my application code...

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
    <mx:ArrayCollection id="arr">
        <mx:Object label="User 1" data="1" count="4"/>
        <mx:Object label="User 2" data="2" count="4"/>
        <mx:Object label="User 3" data="3" count="0" />
        <mx:Object label="User 4" data="4" count="4"/>
        <mx:Object label="Open Position" data="5" count="4"/>
        <mx:Object label="User 6" data="6" count="0"/>
        <mx:Object label="Open Position" data="7" count="4"/>
        <mx:Object label="User 8" data="8" count="0"/>
        <mx:Object label="User 9" data="9" count="4"/>
        <mx:Object label="Open Position" data="10" count="0"/>
        <mx:Object label="User 11" data="11" count="4"/>
        <mx:Object label="Open Position" data="12" count="0"/>
        <mx:Object label="User 13" data="13" count="4"/>
        <mx:Object label="User 14" data="14" count="0"/>
        <mx:Object label="User 15" data="15" count="4"/>
        <mx:Object label="User 16" data="16" count="0"/>
   </mx:ArrayCollection>
   <mx:DataGrid x="161" y="197" id="dg1"  verticalGridLines="false"
horizontalGridLines="true"
        horizontalGridLineColor="#cccccc"
        draggableColumns="true" dataProvider="{arr}">
        <mx:columns>
            <mx:DataGridColumn headerText="Column 1" id="col1" width="150"
itemRenderer="customRadio">

            <!--<mx:itemRenderer>

                <mx:Component>
                <mx:HBox height="50">

                    <mx:RadioButton/>
                    <mx:Image source="s1.gif"/>
                    <mx:Label text="{data.label}"/>


                </mx:HBox>
                </mx:Component>
            </mx:itemRenderer>-->
            </mx:DataGridColumn>
            <mx:DataGridColumn headerText="Column 2" dataField="data" />
            <mx:DataGridColumn headerText="Count" dataField="count"/>
        </mx:columns>
    </mx:DataGrid>

</mx:Application>


And this is my customRenderer code.........
<?xml version="1.0" encoding="utf-8"?>
<mx:RadioButton xmlns:mx="http://www.adobe.com/2006/mxml";>
    <mx:Script>
        <![CDATA[
        public var isSelected:Boolean;
            override public function set data(value:Object):void {
                super.data = value
                if(value){

                      //value.isSelected---> isSelected is temp var in dp,
which wil keep track of
                      //whether it selected or not
                      rad.selected = value.isSelected
                       }
          }
        ]]>
    </mx:Script>
</mx:RadioButton>


Please look once and give me the solution asap

Regards,
Pradeep


On Fri, Feb 19, 2010 at 10:28 AM, nithya flex <[email protected]> wrote:

> well u have data provider dg. before assiging it dp ot dg, add one temp
> boolean  var like isSelected.
>
> intially isSelected=false, so when select radio button, u need to change
> this value.
> isSelected=true
>
> all this u need to do it itemRender, if u can not understand this,
>
> post u r code, I wll fix it
>
>
> On Fri, Feb 19, 2010 at 10:17 AM, pradeep gorijavolu <
> [email protected]> wrote:
>
>> I had seen your blog,in that u r getting selected value from
>> arraycollection
>> But here we are dynamically selected the radiobutton by user.
>>
>> So when scroll happens in the datagrid the selected radio button changes
>> the position in the grid
>>
>> Please let me know what can i do in this situation....
>>
>> Regards,
>> Pradeep
>>
>> On Tue, Feb 16, 2010 at 3:36 PM, FlexiSush <[email protected]> wrote:
>>
>>> hey just refer the solution in my blog at
>>>
>>>
>>> http://flexphpworld.wordpress.com/2010/02/09/datagrid-with-checkbox-as-itemrenderer/
>>>
>>> u need to replace checkbox with radiobutton to suit to ur problem
>>>
>>> regards,
>>> http://flexphpworld.wordpress.com
>>>
>>> On Feb 16, 9:48 am, pradeepflex <[email protected]> wrote:
>>> > Hi All,
>>> >
>>> > I got a problem with rendering a radio button in the datagrid.
>>> > The problem is intially the radiobuttons are renderered but when i
>>> > select one radiobuton
>>> > and scroll the grid the selection row(radiobutton) got changed .
>>> >
>>> > Thanks for any information
>>> >
>>> > Regards,
>>> > Pradeep
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Flex India Community" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<flex_india%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/flex_india?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Flex India Community" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<flex_india%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/flex_india?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to