I want to display the values coming from database in a datagrid using flex. Here is my code. I am using webservice. I have database values from application1_initializeHandler()
method. How to fetch these values into onResult() method and perform databinding? I want code for onResult()
function and data binding. Please help..
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" initialize="application1_initializeHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.rpc.AsyncResponder;
import mx.rpc.AsyncToken;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
protected function application1_initializeHandler(event:FlexEvent):void
{
AreasOfWestBengal.loadWSDL();
var s:String = "SELECT * FROM [CSFTestNew].[dbo].[AreasOfWestBengal]";
var t:AsyncToken = AreasOfWestBengal.GetRec("[AreasOfWestBengal]", s, "1", "SQLExpress");
t.addResponder(new AsyncResponder(onResult, onFault, t));
}
protected function onResult(event:ResultEvent, token:Object=null):void
{
}
protected function onFault(event:FaultEvent, token:Object=null):void
{
trace(event.fault.toString());
}
]]>
</fx:Script>
<fx:Declarations>
<s:WebService id="AreasOfWestBengal" wsdl="https://www.geoviewer8.com/gv8webservices/CSF_NewGVOConfig/GVOConfig.asmx?wsdl"/>
</fx:Declarations>
<mx:DataGrid x="197" y="83" width="348" height="216">
<mx:columns>
<mx:DataGridColumn headerText="Areas" dataField="Areas"/>
<mx:DataGridColumn headerText="SubAreas" dataField="SubAreas"/>
</mx:columns>
</mx:DataGrid>
</s:Application>
Thanks