In your getInvoiceItems method you call “getSapInvoiceItemData” (note lower-case SAP) but in your RemoteObject you declared it as getSAPInvoiceItemData (note upper-case).  Since it’s working on the network monitor I’m guessing you need to change the RemoteObject version to use lower-case.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of jamiebadman
Sent: Thursday, July 14, 2005 6:59 AM
To: [email protected]
Subject: [flexcoders] Second retrieval not working - anyone help ?!

 

Hi,

I wonder if someone has any ideas on this...

I've attached the code at the end.

Basically I have two grids, each attached to a data provider. The
first grid shows a list of invoices then when a row is clicked on, a
call to retrieve invoice line items is issued. These items are to be
displayed in the second grid.

However, it doesn't quite work out that way!

The top grid gets populated with invoices, no problem. Then when I
click on one of them, I can see in the network monitor that the call
to Coldfusion is issued correctly and with the parameters I'd expect.

I then get an 'onResult' from the RemoteObject in the network
monitor and I can see that all the expected data has been returned...

But the second grid does NOT get populated with this data AND
the 'onResult' function - getSAPInvoiceItemDataResult() - does not
get called!

It seems everyone is working correctly right up to the point the
data's sent back for the items then it hits a wall!

I've pored over this for a good time now and have run out of ideas
(not that I had too many to begin with!). Have I missed something
obvious ? Anyone have any ideas why it might be behaving this way ?

Any help is gratefully received!

Thanks,

Jamie.

The code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
      xmlns:mx="http://www.macromedia.com/2003/mxml"
      xmlns="*"
      xmlns:local="localComponents.*"
      xmlns:manageCredits="appScreens.credits.manageCredits.*"
      xmlns:importCredits="appScreens.credits.importCredits.*"
      initialize="searchInvoices()"
      height="650"
      width="1000"
      themeColor="#78CDD7">

      <mx:RemoteObject
            id="creditMethods"
     
      endpoint="http://localhost:8501/flashservices/gateway"
            source="alchemy.coldfusion.creditMethods"
            fault="doFault(event)"
            showBusyCursor="true">
           
            <mx:method name="getSAPInvoiceData"      
                       
      result="getSAPInvoiceDataResult()"
                              fault="doFault(event)" />
           
            <mx:method name="getSAPInvoiceItemData"
                       
      result="getSAPInvoiceItemDataResult()"
                              fault="doFault(event)" />
                             
      </mx:RemoteObject>

      <mx:Array id="invoiceList">
{creditMethods.getSAPInvoiceData.result}</mx:Array>
      <mx:Array id="invoiceItemList">
{creditMethods.getSAPInvoiceItemData.result}</mx:Array>

      <mx:Script>
            function doFault(event:Object):Void {
                  parentDocument.alert("Error invoking CFC: "
+ event.fault.faultstring);
            }

            function cancelPopUp()
            {
                  doLater(this, "deletePopUp");
            }

            function closePopUp()
            {                 
                  doLater(this, "deletePopUp");
            }
     
            function searchInvoices(){
                  creditMethods.getSAPInvoiceData( 2100,
                                               
                                               
                  'GBT0000610',
                                               
                                               
                  '',
                                               
                                               
                  '',
                                               
                                               
                  '',
                                               
                                               
                  21525217 );
            }

            function getInvoiceItems( event ){
                  // Row clicked - so retrieve the items for
this invoice...
                  var currentIndex = 0;
                 
                  currentIndex = dgInvoiceList.selectedIndex;

                  creditMethods.getSapInvoiceItemData( 2100,
                                               
                                               
                              'GBT0000610',
                                               
                                               
                              '21525217' );
            }

            function getSAPInvoiceDataResult(){
                  trace('received the invoices');
            }
           
            function getSAPInvoiceItemDataResult(){
                  trace('received items');
                  trace('length of items ' +
invoiceItemList.length);
            }

      </mx:Script>
           
      <mx:DataGrid id="dgInvoiceList" dataProvider="{invoiceList}"
cellPress="getInvoiceItems( event );" width="100%" height="100%"
hScrollPolicy="auto">
            <mx:columns>
                  <mx:Array>
                        <mx:DataGridColumn
headerText="Invoice Number" width="90" columnName="inv_number"/>
                        <mx:DataGridColumn
headerText="Invoice Ref Number" width="220"
columnName="invoice_ref_number"/>
                        <mx:DataGridColumn
headerText="Document Date" width="100" columnName="document_date"/>
                        <mx:DataGridColumn
headerText="Description" width="100" columnName="description"/>
                        <mx:DataGridColumn
headerText="Currency" width="100" columnName="currency_code"/>
                        <mx:DataGridColumn headerText="Tax
Amount" width="100" columnName="tax_amount"/>
                        <mx:DataGridColumn headerText="Gross
Amount" width="100" columnName="gross_amount"/>
                        <mx:DataGridColumn headerText="Net
Amount" width="100" columnName="net_amount"/>
                  </mx:Array>
            </mx:columns>
      </mx:DataGrid>
     
      <mx:DataGrid id="dgInvoiceItemList"
dataProvider="{invoiceItemList}" width="100%" height="100%"
hScrollPolicy="auto">
            <mx:columns>
                  <mx:Array>
                        <mx:DataGridColumn
headerText="Charge Period" width="120" columnName="charge_period"/>
                        <mx:DataGridColumn
headerText="Product" width="300" columnName="ro_pg4_text"/>
                        <mx:DataGridColumn headerText="Gross
Amount" width="120" columnName="gross_amount"/>
                  </mx:Array>
            </mx:columns>
      </mx:DataGrid>     
</mx:Application>




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to