Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 883

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
The gridDataManager.cfc file
<cfcomponent name="GridDataManager">
<!--- The getFilter function gets the filter XML to populate the dsFilters Spry data set.
It specifies returnFormat=plain to send XML text. --->
<cffunction name="getFilter" access="remote" output="false" returnFormat="plain">
<cffile action="read" file="#ExpandPath('.')#\Filters.xml" variable="filtersxml">
<cfcontent type="text/xml" reset="yes">
<cfreturn filtersxml>
</cffunction>
<!--- The getData function returns books that match the specified genre, or all books if
there is no genre. --->
<cffunction name="getData" access="remote" output="false">
<cfargument name="page" required="yes">
<cfargument name="pageSize" required="yes">
<cfargument name="sortCol" required="yes">
<cfargument name="sortDir" required="yes">
<cfargument name="filter" required="no">
<cfquery name="books" datasource="cfbookclub">
select TITLE, GENRE from BOOKS
<cfif isDefined("arguments.filter") AND arguments.filter NEQ "">
where GENRE = '#arguments.filter#'
</cfif>
<cfif arguments.sortCol NEQ "" AND arguments.sortDir NEQ "">
order by #arguments.sortCol# #arguments.sortDir#
<cfelse>
order by TITLE ASC
</cfif>
</cfquery>
<!--- Return the data only for the current page. --->
<cfreturn QueryConvertForGrid(books, arguments.page,
arguments.pageSize)>
</cffunction>
<!--- The getProductDetails gets data for a single book and converts it to XML for use
in the dsProduct Spry data set. --->
<cffunction name="getProductDetails" access="remote" output="false">
<cfargument name="prodname" default="The Road">
<!--- Get the information about the book from the database. --->
<cfquery name="bookDetails" datasource="cfbookclub">
select TITLE, GENRE, BOOKIMAGE, BOOKDESCRIPTION from BOOKS
where TITLE = '#arguments.prodname#'
</cfquery>
<!--- Convert the query results to XML. --->
Last updated 1/20/2012
878

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents