Thanks Ray, I'll have a play with this. Is it required to use queryConvertForGrid?
Cheers Will -----Original Message----- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: 09 August 2007 12:58 To: CF-Talk Subject: Re: problem binding a cfc to a cfgrid You must define these arguments in your CFC method. <cfargument name="page" type="numeric" required="false"> <cfargument name="pagesize" type="numeric" required="false"> <cfargument name="sortcol" type="string" required="false"> <cfargument name="sortdir" type="string" required="false"> Your code should use this as well to properly page, sort, etc. Don't forget the utility function: queryConvertForGrid. You can pass it a query, arguments.page and arguments.pagedize, and CF will automatically return the right data. Here is a complete example from code I'll soon be using on coldfusionbloggers.org: <cffunction name="getFeeds" access="remote" returnType="struct" output="false"> <cfargument name="page" type="numeric" required="false"> <cfargument name="pagesize" type="numeric" required="false"> <cfargument name="sortcol" type="string" required="false"> <cfargument name="sortdir" type="string" required="false"> <cfargument name="filter" type="string" required="false"> <cfset results = application.entries.getFeeds()> <cfquery name="results" dbtype="query"> select * from results <cfif len(trim(arguments.filter))> where upper(name) like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#ucase(arguments.filter)#%"> or upper(description) like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#ucase(arguments.filter)#%"> </cfif> <cfif len(arguments.sortdir) and len(arguments.sortcol)> order by #arguments.sortcol# #arguments.sortdir# </cfif> </cfquery> <cfreturn queryConvertForGrid(results,arguments.page,arguments.pagesize)> </cffunction> You cna ignore the filter stuff. My code allows me to pass in a filter string to reduce the items returned by the query. A simple example that I'm typing right here and may have have a typo with it: <cffunction name="getFeeds" access="remote" returnType="struct" output="false"> <cfargument name="page" type="numeric" required="false"> <cfargument name="pagesize" type="numeric" required="false"> <cfargument name="sortcol" type="string" required="false"> <cfargument name="sortdir" type="string" required="false"> <cfset results = application.entries.getFeeds()> <cfreturn queryConvertForGrid(results,arguments.page,arguments.pagesize)> </cffunction> On 8/9/07, Will Swain <[EMAIL PROTECTED]> wrote: > Hi, > > I'm playing with this for the first time. I have a cfc with the > following > function: > > <cffunction access="remote" name="getAllAuthors" output="no" > returntype="query" displayname="Get All Authors" hint="Select all > Authors from database"> > > <!--- lets get all the Authors ---> > > <cfquery name="qry_getAuthors" datasource="#Request.dsn_name#"> > SELECT authorID, authorFirstName, authorLastName > FROM tbl_authors > ORDER BY authorLastName ASC; > </cfquery> > > <cfreturn qry_getAuthors> > > </cffunction> > > Which I am trying to bind to a cfgrid as below: > > <cfform> > <cfgrid name="authorsGrid" format="html" stripeRows="true" > bind="cfc:pathfromwebroot.cfcs.authors.getAllAuthors({cfgridpage},{cfg > ridpag esize},{cfgridsortcolumn},{cfgridsortdirection})"> > > <cfgridcolumn name="authorFirstName" header="authorFirstName" > width="300"> > <cfgridcolumn name="authorLastName" header="authorLastName" > width="300"> > <cfgridcolumn name="authorID" header="authorID" width="100"> > > </cfgrid> > </cfform> > > But I get the following error: > > Detail Error parsing bind cfc > pathfromwebroot.cfcs.authors.getAllAuthors({cfgridpage},{cfgridpagesiz > e},{cf > gridsortcolumn},{cfgridsortdirection}) > > Message You cannot specify more arguments to a CFC function than it > declares. > > Any suggestions? I'm sure it's something basic that I'm missing. > > Cheers > > Will > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285798 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

