2 Replies Latest reply on Jul 26, 2006 11:08 AM by Josh Johnson

    Conditional Image from DataGrid Value

    Josh Johnson Level 1
      Hi all,

      Using a custom itemRenderer within my DataGrid, I've been able to add an image. (see code below) Now my problem is this... How does one go about setting the source of the image based on a value within the corresponding data. In my case, the value of the attribute "status" may be either "OK" or "Unreachable", and I want to control the source of the image based on which one is set. How would one do such a thing?

      <mx:DataGridColumn headerText="" dataField="status" width="30" resizable="false">
      <mx:itemRenderer >
      <mx:Component>
      <mx:HBox>
      <mx:Spacer/>
      <mx:Image source="image/ok.png" />
      <mx:Spacer/>
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>