3 Replies Latest reply on May 10, 2011 10:01 PM by Flex harUI

    Datagrid: Select XML element by attribute

    FlexTester

      Hi,

       

      I haven't used Flex in a long time and decided to start a simple app this weekend but hit a problem bringing a service response into a datagrid.

       

      The result that I'm trying to use looks like this:

      <track isSelected="false" time="07:23" url="http://geo-samples.beatport.com/items/volumes/volume6/items/0/600000/80000/7000/200/20/687224.LOFI.mp3" id="687224">
      <name>Imagination</name>
      <urlName>imagination</urlName>
      <mixName>Tiesto Remix</mixName>
      <price>$1.49</price>
      <priceUSD>$1.49</priceUSD>
      <priceEUR>€1.30</priceEUR>
      <priceGBP>£1.12</priceGBP>
      <dateAdded/>
      <dateReleased>2008-09-27</dateReleased>
      <trackNumber>4</trackNumber>
      <trackLength>07:23</trackLength>
      <territories>5,48</territories>
      <image url="http://ak-media.beatport.com/items/imageCatalog/2000000/200000/90000/1000/300/90/2291398.jpg" width="1500" height="250" ref="trackWaveForm"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/300000/0/8000/0/10/308013.jpg" width="30" height="30" ref="release"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/300000/0/8000/0/10/308014.jpg" width="60" height="60" ref="release"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/200000/10000/8000/500/30/218534.jpg" width="30" height="30" ref="label"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/200000/10000/8000/500/30/218535.jpg" width="60" height="60" ref="label"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/600000/20000/7000/700/60/627761.jpg" width="592" height="96" ref="label"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/400000/90000/1000/500/30/491533.jpg" width="60" height="60" ref="default"/>
      <image url="http://ak-media.beatport.com/items/imageCatalog/0/400000/90000/1000/500/30/491534.jpg" width="30" height="30" ref="default"/>
      <fulfillment type="purchase"/>
      <currentStatus id="10">
      <name>General Content</name>
      
      </currentStatus>
      
      
      <release id="136634" exclusive="false">
      <name>Imagination</name>
      
      </release>
      
      
      <label id="9603">
      <name>Velcro</name>
      
      </label>
      
      
      <genre id="7">
      <name>Trance</name>
      
      </genre>
      
      
      <performer ref="Remixer" id="4178">
      <name>Tiesto</name>
      
      </performer>
      
      
      <performer ref="Artist" id="39032">
      <name>JES</name>
      
      </performer>
      
      
      
      </track>
      
      

       

      I want to pupulate a column called Artist from the <performer> section where ref=Artist.  I think that I should be able to use something like this:

      performer.(@ref=='Artist').name
      

      but it isn't working.  I'm still seeing [object Performer] in that column in the grid.  What am I doing wrong?

       

      Here is the complete datagrid block that I'm trying to use:

           <s:DataGrid id="dataGrid" x="43" y="91" width="1075"
                          creationComplete="dataGrid_creationCompleteHandler(event)" requestedRowCount="4">
                <s:columns>
                     <s:ArrayList>
                          <s:GridColumn dataField="time" headerText="time"></s:GridColumn>
                          <s:GridColumn dataField="url" headerText="url"></s:GridColumn>
                          <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                          <s:GridColumn dataField="name" headerText="name"></s:GridColumn>
                          <s:GridColumn dataField="mixName" headerText="mixName"></s:GridColumn>
                          <s:GridColumn dataField="priceUSD" headerText="priceUSD"></s:GridColumn>
                          <s:GridColumn dataField="dateReleased" headerText="dateReleased"></s:GridColumn>
                          <s:GridColumn dataField="trackLength" headerText="trackLength"></s:GridColumn>
                          <s:GridColumn dataField="label" headerText="label"></s:GridColumn>
                          <s:GridColumn dataField="genre" headerText="genre"></s:GridColumn>
                          <s:GridColumn dataField="performer" headerText="Artist"></s:GridColumn>
                     </s:ArrayList>
                </s:columns>
                <s:typicalItem>
                     <fx:Object id="id1" label="label1" currentStatus="currentStatus1" dateAdded="dateAdded1"
                                  dateReleased="dateReleased1" fulfillment="fulfillment1" genre="genre1"
                                  image="image1" isSelected="isSelected1" mixName="mixName1" name="name1"
                                  performer="performer1.(@ref=='Artist').name" price="price1" priceEUR="priceEUR1"
                                  priceGBP="priceGBP1" priceUSD="priceUSD1" release="release1"
                                  territories="territories1" time="time1" trackLength="trackLength1"
                                  trackNumber="trackNumber1" url="url1" urlName="urlName1"></fx:Object>
                </s:typicalItem>
                <s:AsyncListView list="{SearchResult.lastResult}"/>
           </s:DataGrid>
      

       

      I've tried searching for a solution but have not found it.  I'm sure that its simple (and that's probably why its hard to search for, its so obvious to everyone else).

       

      Thanks in advance.