2 Replies Latest reply on Apr 28, 2011 1:54 PM by [Jongware]

    Loading xml data into the datagrid


      Hi all,

      I'm trying to learn Flex. I have a small doubt in loading the datagrid from the xml response (from php script)

      mxml code:

      <mx:DataGrid id="dataGrid" x="69" y="250">


      <mx:DataGridColumn headerText="Name" dataField="name"/>

      <mx:DataGridColumn headerText="Age" dataField="age"/>

      <mx:DataGridColumn headerText="Location" dataField="location"/>



      <mx:HTTPService resultFormat="e4x" result="getDataCallback(event)" id="getDataHttp" url="http://localhost/test/getData.php" method="POST"></mx:HTTPService>

      <mx:Button click="getDataHttp.send();" label="Load Data" x="379" y="268"></mx:Button>



      import mx.collections.ArrayCollection;

      import mx.rpc.events.ResultEvent;

      import mx.controls.Alert;

      [Bindable] public var mydata:XMLList = new XMLList();

      function getDataCallback(event:ResultEvent):void{


      mydata = event.result.data.info;

      dataGrid.dataProvider = mydata;





      PHP Script

      = "<?xml version=\"1.0\" ?><data>";
      $xml .= "
      $xml .= "
      $xml .= "
      echo $xml;

      But the data is not being loaded into the datagrid. Please anyone help me out ..

      Thanks in advance