Converts query data to a structure that contains a paged subset of the query.

queryConvertForGrid(query, page, pageSize) → returns struct

Argument Reference

query string

No Help Available

page numeric

No Help Available

pageSize numeric

No Help Available

Sample code invoking the queryConvertForGrid function

<!--- cfm page ---> 
 <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"/> 
 <!--- 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#"> 
 <cfquery name="team" datasource="cfdocexamples"> 
 <cfreturn queryConvertForGrid(team, page, pageSize)> 

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub