I missed the syntax problem but, interestingly enough, the app works without the <mx:Array> tag - although I'm not sure why. Tracy is correct, the columns property is an Array so it should contain an <mx:Array> tag when declared in mxml.
--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > You do not have an option with the syntax. It must be: > > <mx:columns> > > <mx:Array> > > <mx:DataGridColumn > > ... > > > > Tracy > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Burnham, Christina > Sent: Monday, December 11, 2006 6:01 PM > To: [email protected] > Subject: [flexcoders] Trying to use a mx:model populated by XML file and > then as source to ArrayCollection to populate datagrid > > > > 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 > <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 >

