10 Replies Latest reply on May 28, 2008 8:24 AM by anoweb

    DataGrid ItemRenderer - display image

    anoweb Level 1
      I have a DataGrid and I'd like to display different images (PNG files) in one of the columns based on the value for a given row.

      Say I have an object which looks like this:
      public class LogMsg {
      public var type:String;
      public var msg:String;

      My DataGrid uses an ArrayCollection of LogMsg objects as its "dataProvider". I'd like the "type" column of my DataGrid to display an image instead of the text (i.e. "error", "info", "debug").

      <mx:DataGridColumn dataField="type" headerText="Type" itemRenderer="????" />
      <mx:DataGridColumn dataField="msg" headerText="Message" />

      How would I go about doing this? My application structure on disk looks like this:

      C:\my_app\src\view\MyDataGrid.mxml <-- this is the one with the DataGrid shown above.

      Thanks in advance.