0 Replies Latest reply on May 8, 2018 2:56 PM by KomputerMan.com

    Binding to an ArrayCollection with getItemAt()

    KomputerMan.com Level 1

      I need to bind the data being displayed in a datagrid to an array contained in an array.

      The array of interest is located in AppModel.UserData[0].EmergencyContacts   Where EmergencyContacts holds an array of 1 to n elements.

       

      The structure looks like this:

      Array.PNG

       

      The code I'm using for my datagrid looks like this:

      <mx:DataGrid id="DG_ContactsGrid" y="8" width="530" height="80" change="EditData()"
      dataProvider="{AppModel.UserData.getItemAt(0).EmergencyContacts}" horizontalCenter="0" styleName="DataGrid" >
      <mx:columns>
      <mx:DataGridColumn headerText="Contact Name" dataField="ContactName" width="110" />
      <mx:DataGridColumn headerText="Ph Number" dataField="ContactPhNum" width="80" />
      <mx:DataGridColumn headerText="Relationship" dataField="RelationshipType" width="100" />
      </mx:columns>
      </mx:DataGrid >
      

       

      The form looks like this:

      AFrom.PNG

       

      This code displays the correct values in the datagrid but when I update the data it's not bound to the array.  I can see the contents of the array itself have been updated after the update utility runs but the contents in the datagrid doesn't change.

       

      Any thoughts on why getItemAt() isn't working???   Well other than I'm not using it correctly!!!   :O

       

      Thanks in advance for the insight!!!