One more thing to look at...
 
<mx:RemoteObject id="myService" destination="ColdFusion"
source="getInfo" showBusyCursor="true">
 
I've never tried referring to a cfc according to it's displayname before.
 
Shan


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of michrx7
Sent: Monday, July 24, 2006 4:17 PM
To: [email protected]
Subject: [Junk E-Mail - LOW] [flexcoders] Returning query results to flex from CFC

I am trying to populate a datagrid with results from a cfc. This
should be simple. I have written the simply "Hello World" cfc and
gotten the string to display, but am really struggling getting a
query to return and display. If someone would help it would be
appreciated.

Here is my CFC (getInfo.cfc):
<CFCOMPONENT displayname="admin_rpt_AllMembers">
<CFFUNCTION name="getCompany" access="remote"
returntype="query">
<CFQUERY datasource="myDatabase" name="getMem">
SELECT cvcontactID, cvcontactLast,
cvcontactFirst FROM cvContact
</CFQUERY>
<CFRETURN getMem>
</CFFUNCTION>
</CFCOMPONENT>

Pretty straightforward as I'm only selecting some simple info out of
the database.

Now I have my flex app that should call the cfc, return the query,
and list the info into a simple datagrid. Now I know it's making the
calls to the cfc (using simple Alert.show() calls), but I can't get
the data to display.

Here is my mxml flex file:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" creationComplete="initApp();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.*;
import mx.controls.Alert;

[Bindable]
public var companyInfo:ArrayCollection = null;

public function initApp():void
{
myService.getCompany();
}

public function resultHandler(event:ResultEvent):void
{
var p1:ArrayCollection = new ArrayCollection();
p1.source = event.result as Array;
companyInfo = p1;
}

]]>
</mx:Script>

<mx:RemoteObject id="myService" destination="ColdFusion"
source="admin_rpt_AllMembers" showBusyCursor="true">

<mx:method name="getCompany" result="resultHandler
(event)" fault="Alert.show(event.fault.message)"/>

</mx:RemoteObject>

<mx:DataGrid name="myGrid" id="myGrid" width="100%"
height="100%" dataProvider="{companyInfo}">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="cvcontactID"/>
<mx:DataGridColumn headerText="Last Name"
dataField="cvcontactLast"/>
<mx:DataGridColumn headerText="First Name"
dataField="cvcontactFirst"/>
</mx:columns>
</mx:DataGrid>

<mx:Button click="initApp()"/>

</mx:Application>

I am completely at a loss right now on where to try and change
anything. Thanks for the help in advance.


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.3/395 - Release Date: 7/21/2006

__._,_.___

--
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




__,_._,___

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.3/395 - Release Date: 7/21/2006

Reply via email to