barry
01-20-2009, 10:47 PM
Hi,
i've been having some issues when using the sort() method of an ArrayCollection that acts as a dataProvider for a TileList.
The ArrayCollection contains a list of objects that i want to be able to sort by different properties and display the changes of order within the TileList. Dragging is also enabled on the TileList and everything works as expected as long as the sort method of the ArrayCollection isn't called. I can drag and drop objects around within the TileList to change the order within the ArrayCollection and if i trace the ArrayCollection and ArrayCollection.source, they appear to be the same list/Array of objects.
However, once ArrayCollection.sort has been called, the source array and the ArrayCollection start to differ and no longer mirror each other? The Array that's the source property of the ArrayCollection reflects any changes that have been made to the ArrayCollection from dragging and dropping objects within the TileList, but the ArrayCollection stays the same as when the sort method was called. The TileList appears to reflect the ArrayCollection as opposed to its source Array, so nothing changes within the TileList when Objects are dragged and dropped around?
I call the ArrayCollection.refresh() method once sort has been called on the ArrayCollection and this also works fine, changing the order of the Objects within the TileList to reflect this change. But once it's been called, no more changes can be made (visually), through dragging and dropping. Also the CollectionEvent.COLLECTION_CHANGE is still being fired when ever any changes (through sort or drag and drop) are made, so this doesn't appear to be the issue.
From what i can see through attempting to debug this problem, once the sort method of the ArrayCollection has been called, the source Array and the ArrayCollection appear to become seperate Arrays/lists? Changes still get made to the source property of the ArrayCollection (it's raw Array), but the List of the ArrayCollection stops changing when dragging and dropping.
I hope all this makes sense, apologises that it's a bit long winded, am i missing something really obvious?
Cheers.
i've been having some issues when using the sort() method of an ArrayCollection that acts as a dataProvider for a TileList.
The ArrayCollection contains a list of objects that i want to be able to sort by different properties and display the changes of order within the TileList. Dragging is also enabled on the TileList and everything works as expected as long as the sort method of the ArrayCollection isn't called. I can drag and drop objects around within the TileList to change the order within the ArrayCollection and if i trace the ArrayCollection and ArrayCollection.source, they appear to be the same list/Array of objects.
However, once ArrayCollection.sort has been called, the source array and the ArrayCollection start to differ and no longer mirror each other? The Array that's the source property of the ArrayCollection reflects any changes that have been made to the ArrayCollection from dragging and dropping objects within the TileList, but the ArrayCollection stays the same as when the sort method was called. The TileList appears to reflect the ArrayCollection as opposed to its source Array, so nothing changes within the TileList when Objects are dragged and dropped around?
I call the ArrayCollection.refresh() method once sort has been called on the ArrayCollection and this also works fine, changing the order of the Objects within the TileList to reflect this change. But once it's been called, no more changes can be made (visually), through dragging and dropping. Also the CollectionEvent.COLLECTION_CHANGE is still being fired when ever any changes (through sort or drag and drop) are made, so this doesn't appear to be the issue.
From what i can see through attempting to debug this problem, once the sort method of the ArrayCollection has been called, the source Array and the ArrayCollection appear to become seperate Arrays/lists? Changes still get made to the source property of the ArrayCollection (it's raw Array), but the List of the ArrayCollection stops changing when dragging and dropping.
I hope all this makes sense, apologises that it's a bit long winded, am i missing something really obvious?
Cheers.