0 Replies Latest reply on Jan 7, 2010 12:15 PM by zumorito

    Bindable variable and WebServices



        I am new to flex and am trying to create a simple interactive application which interacts with a Web service.

      I am using a button to trigger the web service call and want to display the data in a data grid component. I also have a Combo box which i am populating with the first column of the same web service's result set.


      The problem I am facing is that both the components seem to have a lag of one click. Which means, when i click the Get Data button to trigger the web service call the first time, the web service returns data (verified by the web service logs) but it is not displayed on the data grid. The next time i click on the Get Data button, the data is displayed.


      I have pasted the code below. Please let me know where i have gone wrong in it.




      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"



      verticalGap="15" horizontalGap="15" >


      <mx:WebService id="dataFetching"




           <mx:operation name="getMRSMarkets">









                   <market>Total Coverage</market>







                    import mx.collections.ArrayCollection;

                    import mx.rpc.events.ResultEvent;

                    import mx.rpc.events.FaultEvent;



                    public var distinctMrkt:ArrayCollection;



                private function getMarkets(): void{


                     distinctMrkt = dataFetching.getMRSMarkets.lastResult as ArrayCollection;

                     table.dataProvider = distinctMrkt;




                private function showGraph(market:String):void{








      <mx:Button id="datafetch" label="Get Data" click="getMarkets()"/>



      <mx:DataGrid id="table" width="100%" >


                <mx:DataGridColumn dataField="a1_market" headerText="Market"/>

                <mx:DataGridColumn dataField="a2_analytic_type" headerText="Analytic Type"/>





      <mx:ComboBox id="dropdown" dataProvider="{distinctMrkt}" labelField="a1_market"





                <mx:Label text="Selected item is: "/>

                <mx:Label id="selected" />