0 Replies Latest reply on Oct 11, 2007 7:54 AM by MNiu

    Itemrenderer with images doesn't work  correctly if variableRowHeight="true"?

    MNiu
      Hi all,

      I have a problem to use itemrenderer in my project:

      I have to show some images in one of my DataGridColumn:
      <mx:DataGridColumn id="datasetcolumn" headerText="DataSet"
      dataField="dataSetList" width="240"itemRenderer="DataSetRenderer"/>

      The dataSetList is an arraycollection of images;

      I use Tile as the itemrederer, My DataSetRenderer is:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Tile xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" width="90%" height="100%" >
      <mx:Metadata>
      [Event(name="showCaddwgNOVWebDataset", type="flash.events.Event")]
      </mx:Metadata>
      <mx:Script>
      <![CDATA[
      import mx.controls.Image;
      import mx.controls.AdvancedDataGrid;
      import mx.core.IFlexDisplayObject;
      import CETEvent.*;
      import view.util.*;
      import mx.collections.ArrayCollection;
      [Bindable] public var myarr:ArrayCollection = new ArrayCollection();

      override public function set data(value:Object):void{
      super.data = value;
      myarr = value.datasetList;
      this.myrep.dataProvider = myarr as ArrayCollection;
      }
      }
      ]]>
      </mx:Script>

      <mx:Repeater id="myrep" visible="true" >
      <mx:Label text="{myrep.currentItem.itIconName}"/>
      <mx:Image id="datasetImg" source="{myrep.currentItem.itIconName}"
      useHandCursor="true" buttonMode="true" mouseChildren="false" toolTip="{myrep.currentItem.itName}"/>
      </mx:Repeater>
      </mx:Tile>


      The problem is:

      Whenever you change the column size or scroll down the datagrid,
      the images will be added again.

      if the datasetlist is changed the old images doesn't clean up and
      all the images messed up

      Any suggestion is appretiated!

      Thanks in advance