Hi,
This is the generic problem we face with itemRenderers , actully
itemRenderes recycle with each refresh, so use custom renderer instead
of mx.controls,checkbox, and set its selected property as required
using
override public function set data(value:object):void
{
super.data = value;
if(data != null){
check.selected = chkValue;//variable name
}
}
set chkValue on the click of check box
On Nov 18, 11:24 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute"
> width="100%" height="100%" creationComplete="addItems()">
> <mx:Script>
> <![CDATA[
> import mx.controls.CheckBox;
> import mx.collections.ArrayCollection;
>
> public var arrRawData:ArrayCollection = new ArrayCollection();
> public function addItems():void
> {
> arrRawData.addItem({id:'A',
> parentId:null,name:'NameA'});
> arrRawData.addItem({id:'D',
> parentId:'A',name:'NameD'});
> arrRawData.addItem({id:'F',
> parentId:'D',name:'NameF'});
> arrRawData.addItem({id:'G',
> parentId:'F',name:'NameG'});
> arrRawData.addItem({id:'H',
> parentId:'F',name:'NameH'});
> arrRawData.addItem({id:'E',
> parentId:'A',name:'NameE'});
> arrRawData.addItem({id:'B',
> parentId:null,name:'NameB'});
> arrRawData.addItem({id:'C',
> parentId:null,name:'NameC'});
> arrRawData.addItem({id:'I',
> parentId:'C',name:'NameI'});
> }
> ]]>
> </mx:Script>
>
> <mx:AdvancedDataGrid id="myADG"
> width="100%" height="177"
> backgroundColor="#EEECD1" visible="true"
> dataProvider="{arrRawData}">
> <mx:columns>
> <mx:AdvancedDataGridColumn dataField="id"
> headerText="Id" />
> <mx:AdvancedDataGridColumn dataField="parentId"
> headerText="ParentId" />
> <mx:AdvancedDataGridColumn dataField="name"
> headerText="Name" />
> <mx:AdvancedDataGridColumn headerText="CheckBox"
> itemRenderer="mx.controls.CheckBox"/>
> </mx:columns>
> </mx:AdvancedDataGrid>
> <mx:DataGrid id="myDG"
> backgroundColor="#EEECD1" visible="true"
> dataProvider="{arrRawData}" x="0" y="185" width="1024">
> <mx:columns>
> <mx:DataGridColumn dataField="id" headerText="Id" />
> <mx:DataGridColumn dataField="parentId"
> headerText="ParentId" />
> <mx:DataGridColumn dataField="name" headerText="Name" /
>
> <mx:DataGridColumn headerText="CheckBox"
> itemRenderer="mx.controls.CheckBox"/>
> </mx:columns>
> </mx:DataGrid>
> </mx:Application>
>
> Now when this code is run ..........data gets populated in the
> datagrid as well as advanceddatagrid ...but the problem is when u
> check the checkboxes..........and then scroll you will find that the
> value of checkboxes starts changing on each scroll ..........can this
> be solved ? and how ................plzzzz help me out with this
> issue .....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---