tags:

views:

40

answers:

1

Hi,

I am using Advanced DataGrid of Flex 3 with hierarchical data and also i added tile list as a item renderer in another column in that tile list i added radiobutton as item renderer if i change the radio selected value the hierarchical tree sould expand if the scroll bar will come the radio button value is changing

<mx:AdvancedDataGrid contextMenu="{cm}" backgroundAlpha="0" styleName="TreeUser" dataProvider="{modelInstance._treeUserXml}" 
id="treeAdg" width="100%" height="100%" showHeaders="false" doubleClick="treeDoubleClick(event)" doubleClickEnabled="true" 
displayItemsExpanded="false" click="onItemClick(event)" borderStyle="none" rowHeight="25">
<mx:columns>
    <mx:AdvancedDataGridColumn dataField="name"/>
    <mx:AdvancedDataGridColumn id="treeItem" itemRenderer="com.Frontend.views.TreeUser.TreeStructureTileList"/>
</mx:columns>

this is advanced data grid adding hierarchical data as a data provider

<containers:TileListEx id="tileList" width="100%" height="100%" textAlign="left"
    horizontalScrollPolicy="off" verticalScrollPolicy="off" direction="horizontal"
    dataProvider="{data.driver}" itemClick="tileItemClick(event)"
    backgroundAlpha="0" borderStyle="none" paddingLeft="0" paddingTop="0"
    useRollOver="false" rowHeight="25" itemRenderer="com.Frontend.views.TreeUser.tieListRenderer">
</containers:TileListEx>

and this is the tile list where i added data.driver as a dataprovider<mx:RadioButton id="radio" label="{data.name}" click="checkClick(event)" width="100%"/>

if i click the radio button value its changing but if scroll will come the value will changing randomly because of itemrenderer help me to resolve this problem

A: 

The problem you're facing is simply that the components created as instances of itemRenderer are reusable across your TileList. So if let's say you click RadioButton that is itemRenderer of first item of the List and then you scroll down, the clicked RadioButton (that dissapeared due to scrolling) will be used as itemRenderer of one of the items that appeared. What you have to do is make your itemRenderer somehow dependent on 'data' property, like adding 'selected' property to it for example and displaying RadioButton as checked if data.selected==true. You also need to set selected to appropriate value in your RadioButton click handler.

2DH
I did this also.. still same issue... Do you have any other solution
Aswath