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

queryConvertForGrid(query, page, pageSize) → returns Struct

Argument Reference for the queryConvertForGrid function


Required: Yes
No Help Available


Required: Yes
No Help Available


Required: Yes
No Help Available

Examples sample code invoking the queryConvertForGrid function

Tag Example

<!--- 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)> 

Fork me on GitHub