Search Flex Samples

TileList is changed to recycle rows in Moxie

That’s right, the TileList has gone green. In the past release, DataGrid and List have already been recycling their rows to give these components better performance. However, the TileList (and HorizontalList) were not recycling rows. This change came about when customer filed a bug (SDK-13887), regarding a memory leak in the TileList component when it used itemRenderers. This bug was causing a serious lag when you had a lot of data and began scrolling in the component.

Alex Harui made the change to add the recycling of rows in changelist 190557. So, you should see a big improvement in the performance of this component. Note that this change did not make our public Beta 3 build (which will be out to the public soon). But, you will see the change in our nightly builds on labs and in the final build of Moxie.

How will this change affect you? Well, in theory, other than the performance improvement, you shouldn’t see any change in your Application. However, we all write bad code sometimes and if you have written an itemRenderer that makes assumptions that each itemRenderer is only associated with one piece of data, then, you might see some unexpected behavior. For example, in a set data function, you might have code like this:

if (data.quantity < 10)
setStyle("fontWeight", "bold");

You will need to change your code to do this:

if (data.quantity < 10)
setStyle("fontWeight", "bold");
else
setStyle("fontWeight", "normal");

The details on best practices when writing itemRenderers can be found on Alex Harui’s blog. The link takes you to a posting that specifically talks about recycling itemRenderers and how to take this into account in your code.

0 comments:

Related Flex Samples

Learn Flex: Flex Samples | Flex Video Tutorials Flex Examples