How do i add a image to a column in the datagrid?
Currently my code is
<mx:DataGridColumn dataField="image" headerText="Photo Image" editable="false">
<mx:itemRenderer>
<mx:Component>
<mx:HBox height="30" horizontalAlign="center">
<mx:Image source="{'assets/image.jpg'}"/>
</mx:HBox>
开发者_StackOverflow中文版 </mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
WGere the dataField = "image" is the name of the picture file.
See below... assuming "image" only has the filename, and not the path of "assets/"
<mx:DataGridColumn dataField="image" headerText="Photo Image" editable="false">
<mx:itemRenderer>
<mx:Component>
<mx:HBox height="30" horizontalAlign="center">
<mx:Image source="{'assets/' + data.image}"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
If the full path to the image is indeed stored in "image", then use this
<mx:Image source="{data.image}"/>
精彩评论