Refreshing Data Group in flex immidiately

56 Views Asked by At

I am using custom item-renderer to render items of my DataGroup. The problems is whenever the value of data-provider(Arraylist in my case) is changed, it takes 6-9 seconds to render, which is unacceptable.

When I tried to back-track the problem, I found that whenever there's less amount of data, DataGroup is refreshed immediately and all the items are rendered within a second.

But whenever there is relatively more amount of data, DataGroup takes 5-7 seconds to get refreshed.

This is my data group :

<s:DataGroup id="selectedInstancesView" dataProvider="{relatedInstances}" width="100%" height="100%"
            itemRenderer="com.ui.renderers.CustomInstanceRenderer"
            clipAndEnableScrolling="true" >

This is the function which re-assigns the value to data-provider of above data group :

private function relatedInstanceRetrieved(event:ResultEvent):void{
    trace("related instances retrieved at :: " + new Date());
    relatedInstances = new ArrayList(event.result as Array);
    trace("related instances populated at :: " + new Date());
}

And This is within my custom-item-renderer class, where I am printing the time on creation-complete of item-renderer :

protected function itemrenderer1_creationCompleteHandler(event:FlexEvent):void
{
    trace("getting rendered at :: " + new Date());      }

And this is the result I am getting :

related instances retrieved at :: Wed Apr 20 **20:58:10** GMT+0530 2016

related instances populated at :: Wed Apr 20 **20:58:10** GMT+0530 2016

getting rendered at :: Wed Apr 20 **20:58:15** GMT+0530 2016

getting rendered at :: Wed Apr 20 20:58:15 GMT+0530 2016

getting rendered at :: Wed Apr 20 20:58:15 GMT+0530 2016

...(1000 similar traces with exact same time)

All the item-renderers (around 1000) are created within a second.

But if you see, the time at which Data-Provider (relatedInstances) is re-populated or re-assigned and the time at which the item-renderers start getting created is 5 seconds, which means it is taking 5 seconds to refresh the data, which is not acceptable.

I tried using invalidateDisplayList(); reassigning the item renderer, and invalidateProperties() methods, But none worked.

I am using flex sdk 4.6

Please enlighten me.

0

There are 0 best solutions below