Reputation: 1057
How do I differentiate between a data provider update and a itemrender being recycled when using a custom itemrenderer in a DataGroup?
I have overridden the set data function of the custom item renderer, but I have found that on making a change to the ArrayCollection used as the DataProvider some of the item renderers are not assigned the same object they had before the update. This has made it almost impossible for me to distinguish between a data update and an itemrender being recycled. Also, the data never seems to get set to a value = null, so that seems to be out as well.
Any ideas?
Upvotes: 1
Views: 1036
Reputation: 505
There is a dataChange event that bubbles up when their is a change to the {data} provider.
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="true" width="142" height="22" dataChange="WHATEVERYOUWANT"
Upvotes: 0
Reputation: 39408
I'm not sure what your asking exactly.
Renderer recycling is the process of changing a renderer's data, often as you scroll through a list based class. This is for performance reasons, so that only items displayed on scree are renderered, not items displayed off screen. Renderer recycling is used to simulate scrolling through a list w/o actually doing so.
When you replace the dataProvider it update all renderers. When you change the dataProvider, it may update some renderers, depending on what the change is. I have gone through the dataGroup code, so I'm not sure exactly what it does for updates, but the Halo listBased classes implementa collectionChange event handler to handle these changes. I would suspect a DataGroup does something similar.
Why do you need to know the reason a renderer's data was changed? The renderer should only care that it was changed.
Upvotes: 1