Converts query data to a structure that contains a paged subset of the query.
queryConvertForGrid(query, page, pageSize)
→ returns struct
<!--- cfm page --->
<cfform>
<cfgrid format="html" name="grid01" pagesize=5 sort=true bind="cfc:places.getData({cfgridpage},{cfgridpagesize}, {cfgridsortcolumn},{cfgridsortdirection})" selectMode="row">
<cfgridcolumn name="Emp_ID" display=true header="Employee ID"/>
<cfgridcolumn name="FirstName" display=true header="Name"/>
<cfgridcolumn name="Email" display=true header="Email"/>
</cfgrid>
</cfform>
<!--- cfc page --->
<cffunction name="getData" access="remote" output="false">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridstartdirection">
<cfset query = "SELECT Emp_ID, FirstName, EMail
FROM Employees" >
<cfif gridsortcolumn neq "" or gridstartdirection neq "">
<cfset query=query & " order by #gridsortcolumn# #gridstartdirection#">
</cfif>
<cfquery name="team" datasource="cfdocexamples">
<cfoutput>#query#</cfoutput>
</cfquery>
<cfreturn queryConvertForGrid(team, page, pageSize)>
</cffunction>
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.