As we know that flex app reads data in the form of XML, so we have to send data from PHP page in the form of XML.So that it can be embed into the datagrid control.
So the PHP page looks like this below, which generates XML lookslike data.
echo “<product>”;
echo “<items>”;
echo “<name1>”Kumar”</name>”;
echo “<name2>”Gandhi”</link>”;
echo “</items>”;
echo “</product>”;
Now in the flex app use HTTPService to get the data,like below.
<mx:HTTPService id=”productlist” url=”product_.php” useProxy=”false” showBusyCursor=”true” />
Now in the datagrid control use the dataprovider property to mention the httpservice id and in the datagridcolumn use the property datafield to the required field in to the column.
<mx:DataGrid x=”10″ y=”39″ height=”200″ id=”datagrid” dataProvider=”{productlist.lastResult.product.items}” >
<mx:columns>
<mx:DataGridColumn headerText=”FirstName” dataField=”name1″ visible=”true”/>
<mx:DataGridColumn headerText=”Last Name” dataField=”name2″ visible=”true”/>
</mx:columns>
</mx:DataGrid>


March 25, 2009 at 8:53 pm |
thanks for this
June 5, 2009 at 8:39 am |
thanks for this
June 26, 2009 at 7:04 am |
please explain the content of dataprovider what is lastResult doing. Thank you .
September 27, 2009 at 3:29 am |
works for me