Problem with AdvanceDataGrid
I am facing problems using AdvanceDataGrid (ADG) as Tree and using itemRenderers.
I want a grid something like this.
To get the checkbox in the ADG, I have used <mx:rendererProviders>
<mx:rendererProviders>
<mx:AdvancedDataGridRendererProvider columnIndex = "1"
dataField = "
mailType" renderer = "com.jpmorgan.bds.dashboard.rephierarchy.view.renderer.CheckBoxADG"/>
</mx:rendererProviders>
The code for CheckBoxADG is as under:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas
xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
>
<mx:Script>
<![CDATA[
private function setData():void
{
if(data.creationCompleteFlag==false
) {
checkBox.selected = data.mailType;
data.creationCompleteFlag =
true
;
}
}
private function changeListData(event:Event):void
{
data.mailType = event.target.selected;
}
]]>
</mx:Script>
<mx:CheckBox id="checkBox
"
styleName="
morcomCheckBox
"
creationComplete="setData()"
change="changeListData(event)"
/>
NOW THE ISSUE:
When I scroll down and then back up again, The data of the checkbox changes. I know why that happens. The creationComplete event is called again when I scroll down (even though the checkboxes are created/rendered). I have no idea why ADG is behaving in this strange way. I am not sure why it is firing a creation complete event when it has already been rendered.
Another funny thing that I have noticed is that - If I scroll down the list very slowly, the creationComplete event does not get fired.
It would be very helpful if someone help me. Or someone from Adobe can explain me this problem.
Thanks in advance for help.
