I am using this for populating a DataGrid from XML or a WebService.
Seems to work with 1 or multiple record sets returned.
[Bindable]
public var myXMLList:XMLList;
result="=new XMLList(event.result);" or
myXMLList=new XMLList(myXML);
<mx:DataGrid id="dgTopPosts" dataProvider='{myXMLList.Item}'>
On Jul 7, 2006, at 11:13 AM, Michael van Leest wrote:
> This example works great, but if there is only 1 item, it generates
> a error.
> Any thoughts on a workaround for this??
>
> Thanks again, Michael
>
> theflashist schreef:
>>
>> You can use the XML as an external data model that the Array
>> Collection can use like
>>
>> <mx:Model id="xmldata" source="my.xml"/>
>> <mx:ArrayCollection id="myAC" source="{xmldata.items.item}"/>
>>
>> The value for source is the name of the model (*xmldata*), the
>> name of
>> the XML's root node (*items* in this example) and the child node that
>> the array will be based on (*item*).
>>
>> HTH...:)
>>
>> P E A C E
>>
>> Hasan
>> www.marxmedia.net <http://www.marxmedia.net>
>> hasan.otuome.com <http://hasan.otuome.com>
>> thesourcecode.org <http://thesourcecode.org>
>>
>>
>> --- In [email protected], Michael van Leest <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi,
>>>
>>> I need to display XML data in a datagrid, but using the XML
>>> directly as
>>> data provider doesn't work.
>>> Is there a easy way to convert a XML Object to an Array or
>>> ArrayCollection?? Or do I need to loop over the nodes and "manual"
>>> create a Array for the datagrid?
>>>
>>> Any info is appreciated.
>>>
>>> Thanks, Michael
>>>
>>
>>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~-->
> Yahoo! Groups gets a make over. See the new email design.
> http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
> --------------------------------------------------------------------
> ~->
>
> --
> 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
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Great things are happening at Yahoo! Groups. See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
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/