Is it possible to change an item in a List's data provider through changing the data property of the List's item renderer?
I know I can get the data provider of the owner of the item renderer, and then just add/replace the item at the specific index, but I don't want the item renderer to need to know so much about its owner.
My specific case is this:
I have some lists (backed by ArrayCollections) that I can drag and drop objects of a certain type between. The lists have the same item renderer, and the item renderers handle the drop event. The data field of the item renderer changes to the dropped object, if it is of the correct type. But this does not change the item in the data provider.
Or is it better to have the drop handler on the owning List, and then figure out which index it is dropped on?
I think it is better to have the drop handler on the owning List, and then figure out which index it is dropped on.
The renderer should just render the data, and not get involved in drag n drop behavior.
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
Thanks Greg, I have refactored it now, and it is a lot cleaner. But what's the best way to highlight the currently hovered cell (to see where the item would drop of I released the mouse)?
Previously, I colored the background fill based on states (normal/hovered), and changed the states in the enterHandler, exitHandler and dropHandler of the ItemRenderer. Is it possible to let Flex take back this control when you're using ItemRenderers?