2009-07-08 78 views
1

是否有可能将一个itemrenderer放在DataGrid本身而不是数据网格列上?我只能找到datagridcolumn的例子。 我想在数据网格中的所有项目上使用通用的itemrenderer ...Flex - Datagrid ItemRenderer

回答

3

是的。 (这是一个Flex 4的例子,但同样适用于3)

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768"> 
    <fx:Script> 
     <![CDATA[ 
      import mx.collections.ArrayCollection; 
      [Bindable] private var dp:ArrayCollection = new ArrayCollection([{far:"test",sight:"test"},{far:"test",sight:"test"},{far:"test",sight:"test"},{far:"test",sight:"test"}]); 
     ]]> 
    </fx:Script> 
    <mx:DataGrid width="100%" height="100%" dataProvider="{dp}"> 
     <mx:itemRenderer> 
      <fx:Component> 
       <mx:Label text="woot there it is"/> 
      </fx:Component> 
     </mx:itemRenderer> 
    </mx:DataGrid> 
</s:Application> 

Peter Ent's itemRenderer Series is killer.

相关问题