2 Replies Latest reply on Jun 28, 2007 9:40 PM by SunnyCloud777

    Weird behaviors of Image in DataGrid itemRenderer

    feef10
      In this test program, I just can't control the visibility of the <image> inside the DataGrid renderer. Also, its size is weird, too. The independent <image> displays the original image and can control the visibility. Why??? Thanks in advance, - James

      <?xml version="1.0">
      <mx:Application xmlns=" http://www.adobe.com/2006/mxml">
      <Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      [Bindable]
      private var attrs:ArrayCollection = new ArrayCollection( [ 0 ] );
      ]]>
      </Script>

      <Image visible="false" source="@Embed('../dirty.png')"/>

      <DataGrid width="100%" top="10" height="100%" dataProvider="{attrs}">
      <columns>
      <DataGridColumn headerText="" dataField="dirty">
      <itemRenderer>
      <Component>
      <mx:Image visible="true" source="@Embed('../dirty.png')"/>
      </Component>
      </itemRenderer>
      </DataGridColumn>
      </columns>
      </DataGrid>

      </Application>
        • 1. Re: Weird behaviors of Image in DataGrid itemRenderer
          leotemp Level 1
          What do you mean you cant control visibilty? do you mean the image set to false is visible or the image set to visible="true" isnt visible or both? If you are trying to change the visiblity from a function make sure to set object.visible= true; not "true"
          • 2. Re: Weird behaviors of Image in DataGrid itemRenderer
            SunnyCloud777
            I have the same problem. Image inside the itemRenderer is always visible regardless the attribute.

            <mx:Image source="@Embed(source='/pics/ft_demo.gif')" visible="false"
            click="navigateToURL(new URLRequest(data.demo_url), '_blank')"/>
            ....
            <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{fl}">
            <mx:columns>
            <mx:DataGridColumn dataField="demo" headerText="Demo">
            <mx:itemRenderer>
            <mx:Component>
            <mx:Image source="@Embed(source='/pics/ft_demo.gif')" visible="false"
            click="navigateToURL(new URLRequest(data.demo_url), '_blank')"
            toolTip="{data.demo}" horizontalAlign="center"/>
            </mx:Component>
            </mx:itemRenderer>
            </mx:DataGridColumn>
            ....

            In the code above, the first image (outside of the grid) is not displayed, but the second one (inside the grid) is shown.