0 Replies Latest reply on Aug 15, 2006 10:20 AM by jsevlie

    Datagrid with itemRenderer to display multiple images

    jsevlie Level 1
      I have a case where I need a column in my datagrid to show multiple images (how many is only determined at runtime).

      The data that gets returned from the web service call has an element for each row in the grid, and then a sub-array that contains an index for each image. Taking the sample code from ( http://www.adobe.com/devnet/flex/quickstart/using_item_renderers/) and re-working it a bit to mimic what I have to deal with, this is what it would essentially look like:

      <artwork>
      <piece>
      <name>The Wall</name>
      <price>250</price>
      <quantity>5</quantity>
      <detail>
      <image>
      <filename>artwork1.jpg</filename
      <caption>ARTWORK 1 CAPTION</filename>
      </image>
      <image>
      <filename>artwork2.jpg</filename
      <caption>ARTWORK 2 CAPTION</filename>
      </image>
      <image>
      <filename>artwork3.jpg</filename
      <caption>ARTWORK 3 CAPTION</filename>
      </image>
      <detail>
      </piece>
      </artwork>

      So, if I have a datagrid like the following:

      <mx:DataGrid x="10" y="18" width="285" height="120" id="artworkGrid" dataProvider="{artworkData}">
      <mx:columns>
      <mx:DataGridColumn headerText="Name" dataField="name" width="125" />
      <mx:DataGridColumn headerText="Price" dataField="price" width="45" textAlign="center" />
      <mx:DataGridColumn headerText="Images" dataField="detail">
      <mx:itemRenderer>
      <mx:Component>
      <mx:Image maxHeight="13" maxWidth="13" ... ???? ... />
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      </mx:columns>
      </mx:DataGrid>

      How in the world can you make the "Images" column display multiple images based on what I have to work with?

      So then I thought about making a HorizontalList, but I'm confused as to the code that needs to be written to support that. All of the examples I'm finding online don't deal with having multiple images for a single datagrid row.

      Please let me know if any of this doesn't make sense, I can elaborate as much as needed.

      Thanks,
      Jacob