Question

I have a List component using multiple item renderers determined by the itemRendererFunction. When I set the data the first time, it works as expected. Then, when I set the data a second time with new data, it doesn't call the itemRendererFunction and tries to reuse the current renderers even though they don't match the data. Once I scroll, the function is called and the correct renderers are used. I tried calling invalidateDisplayList and such prior to setting the data, but that didn't fix the problem. Any ideas?

Was it helpful?

Solution

It turns out this is a Flex SDK bug. Peter DeHaan provided me with a workaround (re-setting the itemRendererFunction property after the dataProvider is set) and is filing it for a future release of the SDK.

OTHER TIPS

Here's just some ideas:

Try invalidateProperties? Looking at the source I have a hunch it could be that, otherwise, perhaps just start calling every invalidate method you can find till you get the right one.

Another sorta hacky solution might be to take not of current scrolling position (via the scroller on the List) pass in a new array as dataprovider (which will definitely recreate the item renderers) then set the scroll position to the same as it was before the refresh.

Or you could abstract out the selection of the different item renderer into the item renderer itself. :/

FWIW: Here's the link to the Flex bug: https://bugs.adobe.com/jira/browse/SDK-32018

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top