Hi Pradeep,

I altered your code . Check it out

Application:

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

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">

<mx:Script>

<![CDATA[

*private* *static* *const* SELECTED:String = *"SELECTED"*;

*private* *static* *const* UNSELECTED:String = *"UNSELECTED"*;

]]>

</mx:Script>

<mx:ArrayCollection id="arr">

<mx:Object label="User 1" data="1" count="4" state="{UNSELECTED}"/>

<mx:Object label="User 2" data="2" count="4" state="{UNSELECTED}"/>

<mx:Object label="User 3" data="3" count="0" state="{UNSELECTED}"/>

<mx:Object label="User 4" data="4" count="4" state="{UNSELECTED}"/>

<mx:Object label="Open Position" data="5" count="4" state="{UNSELECTED}"/>

<mx:Object label="User 6" data="6" count="0" state="{UNSELECTED}"/>

<*mx:Object* label="Open Position" data="7" count="4" state="{UNSELECTED}"/>

<mx:Object label="User 8" data="8" count="0" state="{UNSELECTED}"/>

<mx:Object label="User 9" data="9" count="4" state="{UNSELECTED}"/>

<mx:Object label="Open Position" data="10" count="0" state="{UNSELECTED}"/>

<mx:Object label="User 11" data="11" count="4" state="{UNSELECTED}"/>

<mx:Object label="Open Position" data="12" count="0" state="{UNSELECTED}"/>

<mx:Object label="User 13" data="13" count="4" state="{UNSELECTED}"/>

<mx:Object label="User 14" data="14" count="0" state="{UNSELECTED}"/>

<mx:Object label="User 15" data="15" count="4" state="{UNSELECTED}"/>

<mx:Object label="User 16" data="16" count="0" state="{UNSELECTED}"/>

</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>
Renderer:

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

<mx:RadioButton xmlns:mx="http://www.adobe.com/2006/mxml";
click="onRadioToggle()">

<mx:Script>

<![CDATA[

*import* mx.collections.ArrayCollection;

*public* *var* isSelected:Boolean;

*private* *static* *const* SELECTED:String = *"SELECTED"*;

*private* *static* *const* UNSELECTED:String = *"UNSELECTED"*;

*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
*

*//this.selected = value.selected;
*

*if*(value.state == SELECTED){

*this*.selected = *true*;

}*else*{

*this*.selected = *false*;

}

}

}

*private* *function* onRadioToggle():*void*{

*if*(data.state == UNSELECTED)

{

data.state = SELECTED;

}*else*{

data.state = UNSELECTED;

}

*var* arrObj:ArrayCollection = Object(*this*.owner.parent).arr ;

*if*(arrObj != *null*){

*var* len:int = arrObj.length;

*for*(*var* i:int = 0 ; i < len ; i++){

*if*(data.data != arrObj.getItemAt(i).data)

arrObj.getItemAt(i).state = UNSELECTED

}

}

}

]]>

</mx:Script>

</mx:RadioButton>
Thanks
Arvind


On Fri, Feb 19, 2010 at 11:09 AM, pradeep gorijavolu <
pradeepflex.gr...@gmail.com> wrote:

> 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 <nithya4f...@gmail.com>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 <
>> pradeepflex.gr...@gmail.com> 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 <sushant...@gmail.com> 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 <pradeepflex.gr...@gmail.com> 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 flex_in...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com>
>>>> .
>>>> 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 flex_in...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com>
>>> .
>>> 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 flex_in...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com>
>> .
>> 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 flex_in...@googlegroups.com.
> To unsubscribe from this group, send email to
> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com>
> .
> 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 flex_in...@googlegroups.com.
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to