1 Reply Latest reply on Apr 29, 2010 4:48 PM by Flex harUI

    nested array collection change events

    MatHadder

      Lets say you have a nested array collection which is the source of a Tree.

       

      item A

      - children

      -- item A1

      ---- children

      ------- item B

      ------- children

      -------- item B1

      -------- item B2

      -- item A2

       

      Now say you want to listen for changes anywhere in the collection.

      If you simply add an event listener to the collection variable, the listener will not be invoked if any child collections dispatch a change event.

       

      We can see that the Tree control handles this, because when you add an item to a child,  it updates and the child is shown.

      The Tree control seems to handle this by wrapping the collection in a HierarchicalCollectionView, but this requires several parameters which are not always relevant, e.g. an itemToUID function.

       

      So what is the best way of detecting a change event at any point in the nested collection? Recursive loop over and add a listener to every children collection?