Hi, 

I have simple question about how to write an inline item renderer with the new 
Spark components using the mx:DataGrid. If I try the code below it gives me an 
error that I can't access the data property when using the Spark s:Label. But 
with the mx:Label it works. What am I doing wrong?

Are there any examples out there on how to use custom Spark item renderers with 
the mx:DataGrid? 

Thanks in advance.

Markus

<?xml version="1.0" encoding="utf-8"?>
<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:Declarations>
<s:ArrayCollection id="items">
<fx:Object name="Item 1" col1="1" col2="0"/>
<fx:Object name="Item 2" col1="0" col2="1"/>
<fx:Object name="Item 3" col1="0" col2="0"/>
<fx:Object name="Item 4" col1="-4" col2="44"/>
</s:ArrayCollection>
</fx:Declarations>

<mx:DataGrid id="dataGrid"dataProvider="{items}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name">
<mx:itemRenderer>
<fx:Component>
<s:Label text="{data.name}"/>
<!-- With mx:Label it's working -->
<!--mx:Label text="{data.name}"/-->
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="col1" headerText="Col1"/>
<mx:DataGridColumn dataField="col2" headerText="Col2"/>
</mx:columns>
</mx:DataGrid>

</s:Application>

Reply via email to