Hi
Tarik,
As you
probably noticed, I primarily used your excellent example from your blog.
Thanks for the head start. It has really helped.
I
changed the doResult function as you specified and the error disappeared but the
query still didn't return any results. I looked at the bpurcell example
and he converts his record set into an array. This makes sense except his
version seems to be using Web Services. Nevertheless, it looks like I need
to bind something to the data provider attribute of the DataGrid...I just don't
know how.
Here
are the edits to my code and the CFC:
MXML:
private function
doResult(event:Object):Void{
output.dataProvider = event.result._items;
output.dataProvider = event.result._items;
}
<mx:DataGrid id="output" width="520"
wordWrap="true">
<mx:columns>
<mx:Array>
<mx:DataGridColumn width="200" headerText="Update Form" columnName="FUNCTION"/>
<mx:DataGridColumn width="320" headerText="Description" columnName="DESCRIPTION"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:columns>
<mx:Array>
<mx:DataGridColumn width="200" headerText="Update Form" columnName="FUNCTION"/>
<mx:DataGridColumn width="320" headerText="Description" columnName="DESCRIPTION"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
CFC:
<cfcomponent>
<cffunction name="GetUpdateAuthorization" access="remote" returntype="query">
<cfargument name="AuthorizedUserId" type="string" required="yes">
<cffunction name="GetUpdateAuthorization" access="remote" returntype="query">
<cfargument name="AuthorizedUserId" type="string" required="yes">
<CFSTOREDPROC
PROCEDURE="spUpdateAuthorization"
DATASOURCE="Dev">
<CFPROCPARAM DBVARNAME="AuthorizedUserId" TYPE="IN" VALUE="#Arguments.AuthorizedUserId#" CFSQLTYPE="CF_SQL_CHAR">
<CFPROCPARAM DBVARNAME="CaseFlag" TYPE="IN" VALUE="No" CFSQLTYPE="CF_SQL_CHAR">
<CFPROCPARAM DBVARNAME="CourtOrderAvailableFlag" TYPE="IN" VALUE="No" CFSQLTYPE="CF_SQL_CHAR">
<CFPROCRESULT NAME="qGetUpdateAuthorization">
</CFSTOREDPROC>
<cfreturn qGetUpdateAuthorization>
<CFPROCPARAM DBVARNAME="AuthorizedUserId" TYPE="IN" VALUE="#Arguments.AuthorizedUserId#" CFSQLTYPE="CF_SQL_CHAR">
<CFPROCPARAM DBVARNAME="CaseFlag" TYPE="IN" VALUE="No" CFSQLTYPE="CF_SQL_CHAR">
<CFPROCPARAM DBVARNAME="CourtOrderAvailableFlag" TYPE="IN" VALUE="No" CFSQLTYPE="CF_SQL_CHAR">
<CFPROCRESULT NAME="qGetUpdateAuthorization">
</CFSTOREDPROC>
<cfreturn qGetUpdateAuthorization>
</cffunction>
</cfcomponent>
Thanks,
Darius
-----Original Message-----Hi Darius, welcome.
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of Tarik Ahmed
Sent: Thursday, July 21, 2005 6:28 PM
To: [email protected]
Subject: Re: [flexcoders] Flex and CFCs -- problems displaying recordsets in datagrids
Some things to keep in mind:
- CF and it's CFCs are not case sensitive, where as Flex is. Eg if you
do a CFQUERY and just send the results back, all the fields will be
upper case.
- I think on your doResult you'll need output.dataProvider =
event.result._items;
Here's some articles that should help you out:
http://www.bpurcell.org/blog/index.cfm?mode=entry&entry=1019
http://www.richinternet.de/blog/index.cfm?entry=831FE26E-0D70-9C2D-2549E1D1978CF1B0
coldfs wrote:
>Hi,
>
>I'm new to Flex and have been working over the last few weeks to
>integrate this product with CF. One of my central aims is to be able
>to pass data from Flex to a CFC which houses a query and will return
>a recordset back to Flex. Through piecing together examples here and
>there, I've figured out how to call the CFC and send data to it from
>Flex, but I've been unable to figure out how to display the recordset
>in a Flex datagrid. Any help/examples, best practices, on how to do
>this would be greatly appreciated. My existing code follows. The
>query recordset returns two fields. The error I receive is:
>
>1 Error found.
>
>Error /FlexToCFC2.mxml:19
>There is no property with the name 'text'.
>
>--------------------------------------------------
>
>
><?xml version="1.0" encoding="utf-8"?>
><mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
>xmlns="*">
>
> <mx:Script>
> <![CDATA[
>
> private function doClick():Void{
> ro.GetUpdateAuthorization(input.text);
> }
>
> private function doResult(event:Object):Void{
> output.text = event.result;
> }
>
> private function doFault(event:Object):Void{
> alert("Error invoking CF: " +
>event.fault.faultstring);
> }
>
> ]]>
> </mx:Script>
>
> <mx:RemoteObject id="ro"
>endpoint="http://gx270dev.childsupport.net/flashservices/gateway"
>
> source="Model.mUtilities.mUpdate.qry_UpdateAuthorization"
> fault="doFault(event)"
> result="doResult(event)">
>
> </mx:RemoteObject>
>
> <mx:Panel title="Updates">
> <mx:Form defaultButton="sendButton">
> <mx:FormItem label="Input:"
>direction="horizontal">
> <mx:TextInput id="input"/>
> <mx:Button id="sendButton"
>label="Send" click="doClick()"/>
> </mx:FormItem>
> <mx:DataGrid id="output" width="520"
>wordWrap="true">
> <mx:columns>
> <mx:Array>
> <mx:DataGridColumn width="200"
>headerText="Update Form" columnName="Function"/>
> <mx:DataGridColumn width="320"
>headerText="Description" columnName="Description"/>
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
> </mx:Form>
> </mx:Panel>
>
></mx:Application>
>
>
>Many thanks,
>Darius
>
>
>
>
>
>
>
--
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
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

