Use ArrayCollection
<?xml version="1.0"?>
<!-- dpcontrols/DataGridPassData.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="initData()">
<mx:Script>
<![CDATA[
import mx.collections.*;
private var DGArray:Array = [
{Artist:'Pavement', Album:'Slanted and Enchanted', Price:
11.99},
{Artist:'Pavement', Album:'Brighten the Corners', Price:
11.99}];
[Bindable]
public var initDG:ArrayCollection;
//Initialize initDG ArrayCollection variable from the Array.
//You can use this technique to convert an HTTPService,
//WebService, or RemoteObject result to ArrayCollection.
public function initData():void {
initDG=new ArrayCollection(DGArray);
}
]]>
</mx:Script>
<mx:DataGrid id="myGrid" width="350" height="200"
dataProvider="{initDG}" >
<mx:columns>
<mx:DataGridColumn dataField="Album" />
<mx:DataGridColumn dataField="Price" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
Check out this example.The data should be in this format.R u getting
till here?
Note:For next queries-Please specify the topic as issue and not help
or any such thing.This will increase the no. of right guys opeing ur
mail.
On Apr 20, 11:08 am, rakshith sharma <[email protected]> wrote:
> <mx:DataGrid dataProvider="{dp}" x="254" y="143" width="255" enabled="true"
> id="sandy">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn dataField="user_id"/>
> <mx:DataGridColumn dataField="username"/>
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
>
> this is wat i modified in the code....
> its still not showing any output...
> so plzzzz guide me through this..
> i am a beginer to flex so plzzz
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---