Disclaimer, I'm new to Flex.  Been using it for just over a month.

I've hit my first speedbump.  I am trying to dynamically add an image
to a DataGridColumn.  I have an xml file that is being read via a
HttpService.  Everything looks great.  It's loading a customer list
into a DataGrid.  I have a column that is mapped to a gender attribute
in my xml.  I want to move from displaying a 'f' or 'm' in the column
to displaying a male or female image in the column.

I first tried using the labelFunction on DataGridColumn to get a
image, and all that returned was the filename, but not the image.

Now I'm stuck.  I've kind of given up on the dynamic method and have
modified my xml adding an attribute that points to the gender image. 
I'm still having no luck.  I am simply getting a broken image in my
DataGridColumn.

I've found a lot of examples that show doing something similar to this
with an Array, but none with XML.  Any help would be greatly appreciated.

I'm attaching some code below to show what I'm doing.  It will only be
snippets, but I'll be glad to zip up and send what I've got.

Erik Weibust

Code Snippets:
<mx:DataGrid 
id="custList"
change="populateForm(event)"
width="100%"
height="100%"
styleName="custLabel"
dataProvider="{customersDP}">

<mx:columns>

<mx:DataGridColumn headerText="gender"
width="80">
<mx:itemRenderer>
<mx:Component>
<mx:Image  source="@gender_image" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

<!-- <mx:DataGridColumn dataField="@gender_image" headerText="gender"
/> -->

<mx:DataGridColumn dataField="@name" headerText="customer" />

Reply via email to