0 Replies Latest reply on Mar 9, 2011 8:52 AM by Handycam

    Conditionally hide an image in grid renderer if data is empty?

    Handycam Level 1

      I have a project that mostly uses Spark Lists.  For some of the items in my collection, a particular image might not exist or be required; I leave that XML node empty.  This is working fine in the spark renderer for the List, like this:

       

      <mx:Image width="120" source="images/logos/{XML(data).logo}" visible="{XML(data).logo.length>0}" />
      
      

       

      However, in this project I also need to use a PrintDataGrid of the same data for printing.

       

      But for some reason, a similar approach just leads to the images printing anyway, which of course print as "broken" images.

       

      <mx:DataGridColumn width="120">
           <mx:itemRenderer>
                <fx:Component>
                     <mx:Image width="120" height="75"  source="images/logos/{XML(data).logo}" visible="{XML(data).logo.length>0}"   />
                </fx:Component>
           </mx:itemRenderer>
      </mx:DataGridColumn>
      

       

      How can I not show the image in the PrintDataGrid when appropriate, as I can with the List?