![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
Hi..
I am using web service to fill a grid, in the web method i have to pass two parameters, it will return result of xml document. The same i want to fill in a DataGrid using Flex. Please help me..its urgent |
| Sponsored Links |
|
|||
|
Hi,
This is very easy. Send a httpservice with the two parameters to the backend which gives back an xml document. You can use that as the dataprovider of the grid. In case you want further details post the sample xml code and i can post a detailed code as to how to do this . also mention the backend u r using.. |
|
|||
|
Hi,
Thank you for reply..but i want to use web service instead of http service. Sending you the sample code..please work on that and help me in binding to the grid. Sample.mxml <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="center" verticalAlign="middle" width="900" height="600" creationComplete="initApp()" backgroundGradientColors="[0x000000,0x323232]" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.controls.Label; import mx.controls.Button; import mx.controls.TextInput; import mx.controls.DataGrid; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.utils.ObjectUtil; private function initApp():void { trace("Hello from Flex Debugging!"); } private function auth():void{ S.Authenticate.send(); } private function Authenticate_result(evt1:ResultEvent):void{ token.text = ObjectUtil.toString(evt1.result); S1.GetloggedInUserList(); } private function Authenticate_fault(evt2:FaultEvent):void{ token.text = ObjectUtil.toString(evt2.message); } private function GetloggedInUserList_result(event:ResultEvent):void { token1.text= "Result"; var adg ataGrid = new DataGrid();dg.dataProvider= event.result.toString(); //adg.dataProvider = XML(event.result).toString(); } private function GetloggedInUserList_fault(evt4:FaultEvent):void{ token1.text= "Fault"; } ]]> </mx:Script> <mx:WebService id="S" wsdl="http://localhost:2630/Web%20Services/Authent ication.asmx?WSDL" useProxy="false"> <mx peration name="Authenticate"resultFormat="object" result="Authenticate_result(event);" fault="Authenticate_fault(event);"> <mx:request xmlns=""> <UserId> {_txtuserid.text} </UserId> <Password> {_txtpassword.text} </Password> </mx:request> </mx peration></mx:WebService> <mx:WebService id="S1" wsdl="http://localhost:2630/Web%20Services/Resourc eManager.asmx?WSDL" showBusyCursor="true" useProxy="false"> <mx peration name="GetloggedInUserList"resultFormat="object" result="GetloggedInUserList_result(event);" fault="GetloggedInUserList_fault(event);"> <mx:request xmlns=""> <securityToken> {token.text} </securityToken> </mx:request> </mx peration></mx:WebService> <mx:Label x="303" y="10" text="Login Procedure....." width="186" fontSize="15" fontWeight="bold" color="#DFEAE7"/> <mx:Button x="100" y="117" label="Login" id ="btnOk" click="auth();" width="60"/> <mx:Label x="100" y="172" id="token" color="#E3EEF1"/> <mx:Label x="100" y="198" id="token1" color="#F4F8F9"/> <mx:Label x="10" y="61" text="User Name:" id="_lblUsername" color="#F2EFEF"/> <mx:Label x="20" y="87" text="Password:" id="_lblPassword" color="#F2EFEF"/> <mx:TextInput x="100" y="61" id="_txtuserid" text="demo" width="142"/> <mx:TextInput x="100" y="87" id="_txtpassword" text="demo" width="142" displayAsPassword="true"/> <mx:Button x="194" y="117" label="Exit" id="btnExit" click="this.close();"/> <mx ataGrid id="adg" width="100%" height="351" y="247" ></mx ataGrid></mx:WindowedApplication> After login..i want to fill the result in the datagrid Help me in doing the same thanks in advance |
|
|||
|
I understand.
1) In GetloggedInUserList_result, get rid of the var "adg ataGrid = newDataGrid();". You already have the data grid declared in MXML so you don't need to do this. 2) Instead of "dg.dataProvider= event.result.toString();"... (btw your datagrid's id is "adg", NOT "dg")... ... try adg.dataProvider= S1.GetloggedInUserList.lastResult; I can't see the data you are returning, but this should get you started in the right direction. Remember you can always examine the returned data and see how to assign it to the datagrid's dataprovider property. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise