have you tried the change or the updateComplete event?
yes - the "change" event only fires on a change of the selected index of the datagrid
the "update complete" does not fire when some of the data change within a line in the datagrid.
I have now moved on to try the "collectionEvent.collection_change" event on the dataprovider itself ( i got around the null problem) but this again does not fire if the dataprovider is an arraycollection that contains an arraycolllection itself that changes.
Any other suggestions?
you could fire something off in the getter/setter of the array collection
I have had to use a couple of events to get what i want - i'm still testing but i've used the CollectionEvent.COLLECTION_CHANGE event on the dataProvider for the datagrid and also the ITEM_CLICK event on the datagrid. It may not be perfect but it seems to be close to what I need.
I'd still be interested to hear if anyone has other suggestions.
That doesn't sound right. The theoretically correct way would be get
changes from nested array collections is to have the top-level array
collection listen for COLLECTION_CHANGE from the sub-collections and fire
its own COLLECTION_CHANGE event.
Thanks for the reply - I usually avoid firing my own flex events - but if that's the adobe recommended way i'll give it a go.
We have not formalized the concept of nested collections in Flex. However,
let me amend my recommendation a bit.
Typically in a nested collection, the objects in the top-level collection
are not just collections but an object with some other reference data and
then a collection like:
public class FamilyTreeItem
public var name:String;
public var children:ArrayCollection;
The top-level collection is listening for propertyChange events. Typically,
as a data item gets modified, a propertyChange event is dispatched. If the
data items do not dispatch propertyChange events, then the itemUpdated()
method is used. Either way, the result is a COLLECTION_CHANGE event from
the top-level collection.
When you have a nested ArrayCollection, while that sub-ArrayCollection is
dispatching COLLECTION_CHANGE, nobody is listening for it at the top-level.
You can dispatch it yourself, or you can call itemUpdated() on the top-level
or dispatch a propertyChange.
The latter will be the most work, but most general. Code in FamilyTreeItem
would attach a listener to the collection for COLLECTION_CHANGE and then
dispatch a propertyChange as appropriate.
Thanks for the extra information. I tried dispatching the collection event myself but as i was doing this from a custom item renderer it appeared to create an infinite loop. I then changed this to call the itemUpdated method on the dataprovider and that did the trick! CollectionEvent.COLLECTIION_CHANGE then fired and now I just use that event to detect any change in the dataProvider. Great!
Thanks again for you help.