Item Renderers causing problems while scrolling… state gets changed..

Hi All,

The data grid use lazy creation techniques while dealing with Item Renderers, For example if you have 300 rows in data grid and if only 100 are visible then only 100 ItemRenderers will be created. And when you scroll the data grid it again do the same thing for the columns which are getting visible to the user in that point of time. The reason is that When the ItemRenderer is reused, the DataGrid sets the data property with the new data and that’s it – it is not destroyed re-instantiated.

To fix this problem, Simply we need to set up/configure the item renderer again in “set data” method of the container. e.g

public  override function  set data(value:Object):void{
// This will fire off the FlexEvent.DATA_CHANGE Event
super.data = value;
// if the value is null this cell is empty
if(value == null){
// clear all the controls
return;
}
//again configure the controls
// for example if you’re adding checkboxes, again add the logic/configure here.
}

Hope this helps.


Thanks
R Vashi