1 Reply Latest reply on Dec 7, 2006 7:14 PM by ntsiii

    getting change values from a collection

    eclesia
      Title says it all. I have a collection connected to a datagrid and have a simple form that allows me to add/modify/delete entries from the collection. Now I want to send the changes to the collection back to the server. How do I read/parse the collection for these changes? Examples would be helpful. Below is what I have so far to examine the collection (found elsewhere) how do I extract the name/value pairs that have changed?

      public function collectionEventHandler(event:CollectionEvent):void {
      switch(event.kind) {
      case CollectionEventKind.ADD:
      addLog("Item "+ event.location + " added");
      break;
      case CollectionEventKind.REMOVE:
      addLog("Item "+ event.location + " removed");
      break;
      case CollectionEventKind.REPLACE:
      addLog("Item "+ event.location + " Replaced");
      break;
      case CollectionEventKind.UPDATE:
      addLog("Item updated");
      break;
      }
      }
        • 1. Re: getting change values from a collection
          ntsiii Level 3
          ArrayCollection supports the length property, so you can simply iterate over it with a for loop and use the bracket notation to return each item. Build the structure you want to sent, then away you go.

          If you are wanting to only select changed values, you will have to track this yourself.

          Tracy