Hi there. I have had a lot of trouble over the Flex 2 launch with
getting XML to behave correctly as a DataProvider. I have found that
converting the XML to an ArrayCollection first solves most problems.
YOu don't have to do it by looping either. You can typically use the
<mx:Model> tag to accomplish it simply.

See the following post:

http://www.mail-archive.com/[email protected]/msg33137.html

HTH
-Kenny

--- In [email protected], "Jeff Kroll" <[EMAIL PROTECTED]> wrote:
>
> I'm stuck! I can't get an inline renderer for DataGridColumn to work
> with an XML data provider, even though it works just fine for an Array
> data provider. Please see the example code.
>  
> Thanks in advance!
> Jeff
>  
>  
> <?xml version="1.0"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; height="350"
> width="250">
>     
>     <mx:Script>
>         <![CDATA[
>                 
>             [Bindable]
>             public var myTestArray:Array =                 [
>                     {label1:"/home", Test:true},
>                     {label1:"/bin", Test:false}];
>         ]]>
>     </mx:Script>
>  
>  <mx:XMLListCollection id="myTestXML">
>   <mx:XMLList xmlns="">
>    <partition label="C:\\" Test="true"/>
>    <partition label="D:\\" Test="false"/>
>   </mx:XMLList>
>  </mx:XMLListCollection>
>  
>  <!-- This works just fine with an Array data provider --> 
>  <mx:DataGrid dataProvider="{myTestArray}" width="200" height="100"
> editable="true">
>   <mx:columns>
>    <mx:DataGridColumn headerText="myTestArray" dataField="Test"
> rendererIsEditor="true" editorDataField="selected">
>     <mx:itemRenderer>
>      <mx:Component>
>       <mx:CheckBox selected="{data.Test}" label="{data.label1}"/>
>      </mx:Component>
>     </mx:itemRenderer>
>    </mx:DataGridColumn>
>   </mx:columns>
>  </mx:DataGrid>
>  
>  <!-- Why doesn't this work with an XML data provider? --> 
>  <!-- What are my options for getting it to work with the XML data
> provider? -->
>  <!-- I'd prefer a solution that is similar to the current code
> "framework" I've got. --> 
>  <mx:DataGrid dataProvider="{myTestXML}" width="200" height="100"
> editable="true">
>   <mx:columns>
>    <mx:DataGridColumn headerText="myTestXML" dataField="@Test"
> rendererIsEditor="true" editorDataField="selected">
>     <mx:itemRenderer>
>      <mx:Component>
>       <mx:CheckBox selected="{data.Test}" label="{data.label1}"/>
>      </mx:Component>
>     </mx:itemRenderer>
>    </mx:DataGridColumn>
>   </mx:columns>
>  </mx:DataGrid>
> </mx:Application>
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to