To
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var a:ArrayCollection = new ArrayCollection([{data:'P'},{data:'G'},{data:'P'}]); private function init():void{ /* var a:ArrayCollection=new ArrayCollection(); a.addItem("First"); a.addItem("Second"); a.addItem("Third"); a.refresh(); */ dg.dataProvider = a } ]]> </mx:Script> <mx:DataGrid id="dg" > </mx:DataGrid> </mx:Application> try this way On Tue, Apr 28, 2009 at 12:57 PM, flex <[email protected]> wrote: > > hi all, > can we add array collection to datagrid like this, here it is giving > runtime error. > private function init():void{ > var a:ArrayCollection=new ArrayCollection(); > a.addItem("First");a.addItem("Second");a.addItem("Third"); > var d:DataGrid = new DataGrid(); > d.dataProvider=a; > } > ]]> > </mx:Script> > <mx:DataGrid id="dg" /> > thank you > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

