2 Replies Latest reply on Sep 2, 2010 12:37 PM by CenturyMan1979

    How to check for data binding updates?

    CenturyMan1979 Level 2

      Hi all,

       

      So I created a component in flex and added a setter and getter for a dataprovider,

       

      [Bindable] private var __dataProvider:ArrayCollection = new ArrayCollection();
                 
      public function set dataProvider(value:ArrayCollection):void {
           if (value!=null)
           __dataProvider=value;
           updateFunc(); // Process __dataProvider to display on the screen
      }
           
      public function get dataProvider():ArrayCollection {
           return __dataProvider;
      }   
      

       

      So I add it to flex,

       

      <comp:MyComp id="myComp" dataProvider="{data}" />
      

       

      This works great when the app starts up but say I add something to the data ArrayCollection like this,

       

      data.addItem(someObj);
      

       

      My app can't seem to figure out that the __dataProvider has been updated via the dataBinding which I need to then call updateFunc() to update the display . I tried using an eventListener but the only one available for ArrayCollection is CollectionEvent.COLLECTION_CHANGE which was not getting triggered.

       

      Thanks for any help you can provide.