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 = value;
// if the value is null this cell is empty
if(value == null){
// clear all the controls
//again configure the controls
// for example if you’re adding checkboxes, again add the logic/configure here.

Hope this helps.

R Vashi

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

  1. Dave

    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. Drew

    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. Saurav Ashok

    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

Please log in using one of these methods to post your comment: Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.