Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 831

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
If you do not want the grid to refresh automatically when other controls change, you can use the
optional bind parameters. Doing this, prevents automatic updating of the grid based on the bound control values. Use
the ColdFusion.Grid.refresh JavaScript function to explicitly refresh the grid contents. For more information on the
use of the
specifier and explicitly refreshing the control, see
@none
If the grid supports user sorting of the data (the
return data in the desired sorted order, and must use the values of the
bind parameters to determine the order. Even if you do not allow user sorting, still pass these
cfgridsortdirection
parameters to the function; otherwise, you get an error. Also, your function or action page must handle cases where
these parameters are empty strings, because their values are not set until the user selects a column header to sort the
grid, or you call the JavaScript
The format of the returned data depends on how you get the data:
Bind type
CFC
URL
JavaScript
When you specify a CFC in the
into a structure that you can use as your CFC return value.
When you specify a CFML page in the
a structure, and then use the
If you manually create a JavaScript object or its JSON representation, it must have two top-level keys:
: The total number of rows in the query data set being returned. This value is the total number of
TOTALROWCOUNT
rows of data in all pages in the grid, and not the number of rows in the current page.
: The contents of the query being returned
QUERY
: An array of the column names.
COLUMNS
: A two-dimensional array, where the first dimension corresponds to the rows and the second dimension
DATA
corresponds to the field values, in the same order as the
Note: If a CFC manually creates a return structure, the
automatically converts it for remote access.
The following example defines an object that a JavaScript bind function can return to provide the data for a
var myobject =
{"TOTALROWCOUNT":6,"QUERY":{"COLUMNS":["EMP_ID","FIRSTNAME",
"EMAIL"],"DATA":[[1,"Carolynn","CPETERSON"],
[2,"Dave","FHEARTSDALE"], [3,"Linda","LSTEWART"],
[4,"Aaron","ASMITH"], [5,"Peter","PBARKEN"],
[6,"Linda","LJENNINGS"],]}};
The following example uses a bind expression and a CFC to populate a dynamic, paged, data grid. The CFML page
contains the following form:
attribute is
sort
function.
ColdFusion.Grid.sort
Return value
A ColdFusion structure. ColdFusion automatically converts the structure for return to the caller.
Alternatively, you can return a JSON representation of the structure.
A JSON representation of a structure. No other body contents is allowed.
A JavaScript object.
attribute, use the
bind
queryConvertForGrid
attribute, use the
bind
function to convert the structure into a JSON representation.
serializeJSON
The
.
QUERY
Last updated 1/20/2012
"Specifying bind
parameters" on page 861.
), the function called by the bind expression must
true
cfgridsortcolumn
function to convert a query directly
function to convert a query into
queryConvertForGrid
value must also be an object with two keys:
QUERY
array.
COLUMNS
value can be a ColdFusion query object; ColdFusion
826
specifier on all
@none
and
tag:
cfgrid

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents