Hi,

I have a list that I want to populate with data from a CFC, but all I 
get with my current code is a list with every row reading '[object 
Object]' instead of actual data from my web service.  The web service 
should just be returning an array (also, is an array the best way to 
return data for a list?).

Main code of CFC that returns data:

<cfquery name="GetServiceTypes" datasource="STO5">
        SELECT
                pkServiceTypeID,
                Description
        FROM tblSYS_ServiceTypes WITH (NOLOCK)
        ORDER BY Description
</cfquery>
        
<cfset ServiceTypeArray = ArrayNew(1)>
        
<cfoutput query="GetServiceTypes">
        <cfset ServiceTypeArray[CurrentRow] = StructNew()>
        <cfset ServiceTypeArray[CurrentRow].serviceTypeID = 
pkServiceTypeID>
        <cfset ServiceTypeArray[CurrentRow].description = Description>
</cfoutput>
        
<cfreturn ServiceTypeArray>

Main elements of MXML that pertain to the list:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
        layout="absolute"
        creationComplete="perfManWS.GetServiceTypes.send();">
<mx:Script>
        <![CDATA[
 [Bindable] private var serviceTypeDP:ArrayCollection;

 private function serviceTypeHandler(event:ResultEvent):void {
                serviceTypeDP = (event.result as ArrayCollection);
            }
 ]]>
    </mx:Script>

 <mx:WebService id="perfManWS"
    
        wsdl="http://development/dev1/workspaces/lisa/components/perfo
rmancemanagement.cfc?wsdl">
        <mx:operation name="GetServiceTypes" 
result="serviceTypeHandler(event)">
                <mx:request>
                        <UName>xxx</UName>
                        <UPassword>xxx</UPassword>
                </mx:request>
        </mx:operation>
</mx:WebService>

<mx:List id="stComboList"
                                        
        dataProvider="{serviceTypeDP}"
                                        
        labelField="description"
                                                                
        allowMultipleSelection="true"/>

</mx:Application>

Reply via email to