Change the model property referenced by the ArrayCollection source
to "animalList.pet" and specify it as an array (an Object is
returned when there is only a single item), and it should work:
<mx:ArrayCollection id="anListAC"
source="{ [ animalList.pet ] }"/>
--- In [email protected], "Burnham, Christina"
<[EMAIL PROTECTED]> wrote:
>
> I'm learning Flex 2 and I'm trying to get this example to work and
I'm
> about to give up. My datagrid comes up empty. It works fine when
I hard
> code the data in an array inside a datarovider within the
mx:DataGrid
> tags I also tried putting the DataGridColumns inside of Array
tags. No
> joy, nothing but empty datagrid.
>
> I'm running on XP using IE and using Flex 2 in the Eclipse IDE.
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute">
> <mx:Model id="animalList" source="pets.xml">
> </mx:Model>
> <mx:ArrayCollection id="anListAC"
> source="{animalList.animals.pet}"/>
> <mx:DataGrid x="75" y="98" dataProvider = "{anListAC}">
> <mx:columns>
> <mx:DataGridColumn headerText="Type"
dataField="anType"/>
> <mx:DataGridColumn headerText="Name"
dataField="anName"/>
> <mx:DataGridColumn headerText="Living"
> dataField="anLiving"/>
> </mx:columns>
> </mx:DataGrid>
> </mx:Application>
>
> This is the XML file:
>
> <?xml version="1.0"?>
> <animals>
> <pet>
> <anType>Cat</anType>
> <anName>GoldenBoy</anName>
> <anLiving>Yes</anLiving>
> </pet>
> </animals>
>
> Thanks in advance
> Christina
>