Is it possible to put an itemrenderer on the DataGrid itself rather than a datagridcolumn? I could only find examples for datagridcolumn. I want a generic itemrenderer on all the items in a datagrid...
+3
A:
Yes. (this is a Flex 4 example, but same is true for 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>
[http://weblogs.macromedia.com/pent/archives/2008/03/itemrenderers_p.html Peter Ent's itemRenderer Series] is killer.
Joel Hooks
2009-07-08 15:27:05