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

4 thoughts on “Item Renderers causing problems while scrolling… state gets changed..

  1. Oh My God, I was looking for this answer all over for days! Thank You so much. It should be posted in the front of the flex site. They really need to handle there renderers better. How about a event that is triggered when ever the renderer is moved to a new row.

    Thank You!!!!!!

  2. I keep hitting this issue when I work with Flex.. Except my renderes are very complex and large lists that it causes the scroll to be clunky..

    Not impress Adobe… If its rendered at index 1, just keep it there… Why do I have to rebuild my rederer every time 😦

  3. Hi All,

    I’m also became the victim of same issue that you guys mentioned in the original thread.
    Please provide the detail code how to use it,as Iam new to Flex.

    Thanks in advance.

    Saurav Ashok

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s