2 Replies Latest reply on Jun 30, 2008 3:46 AM by Karl_Sigiscar_1971

    ArrayCollection

    GeorgeWS Level 1
      I have an arraycollection, Called myPrices. I just want to display the Product number from the arraycollection. I dont know the syntax.

      This gets me [Object.object]
      <mx:Text text="{myPrices}"/>

      If I make a datagrid and make one column be PWDL01 I get the record I want.

      How can I show the PWDL01 in the text?
      There is only one record in the array but a bunch of fields

      Thanks
      George
        • 1. Re: ArrayCollection
          LinkMc Level 1
          hi George,

          you are getting object object, because it is returning an object.

          to get a specific item from the object within the datagrid

          mydata.selectedItem.mydatacolumn - id of my datagrid is mydata and the column information I want to display is mydataColumn.

          Now you can say this too.

          mydata.getItemAt(0).mydatacolumn - this will return the item in the 0 position of the data grid. remember that arrays are 0 or zero based, meaning they start at 0 instead of one.

          now if I wanted to get this from my array Collection I would call:

          myarrayCollection.getItemAt(0).mydatacolumn


          • 2. Re: ArrayCollection
            Karl_Sigiscar_1971 Level 3

            If you use DTOs instead of Objects, cast the object you get from your array collection so you can access properties using autocompletion, e.g:

            (myPrices.getItemAt(0) as Product).PWDL01

            To get the PWDL01 in the text:
            <mx:Text text="{(myPrices.getItemAt(0) as Product).PWDL01}"/>