For everyone who's interested. Here is how it's working:
<?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:MXDataGridItemRenderer>
<s:Label text="{data.name}"/>
</s:MXDataGridItemRenderer>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="col1" headerText="Col1"/>
<mx:DataGridColumn dataField="col2" headerText="Col2"/>
</mx:columns>
</mx:DataGrid>
</s:Application>
--- In [email protected], "Markus" <kram...@...> wrote:
>
> Thanks Alex for that good advice. I'll have a look.
>
> Markus
>
> --- In [email protected], Alex Harui <aharui@> wrote:
> >
> > New feature to make that easier due soon. Part of it is already in the
> > nightly builds. Search for MXDataGridItemRenderer
> >
> > Alex Harui
> > Flex SDK Developer
> > Adobe Systems Inc.<http://www.adobe.com/>
> > Blog: http://blogs.adobe.com/aharui
> >
> > From: [email protected] [mailto:[email protected]] On
> > Behalf Of Markus
> > Sent: Tuesday, December 08, 2009 5:55 AM
> > To: [email protected]
> > Subject: [flexcoders] Spark / mx:DataGrid inline item renderer
> >
> >
> >
> > 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>
> >
>