Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 840

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Bind type
CFC
JavaScript
URL
Each structure in the array of structures or objects defines the contents and appearance of the node for a child item.
Each structure must have a VALUE field, and can have the following fields. Except for LEAFNODE, these structure
keys correspond to cftreeitem attributes.
• DISPLAY
• EXPAND
• HREF
• IMG
• IMGOPEN
• LEAFNODE
• TARGET
Note: If a CFC does not return a value field, you do not get an error, but the tree does not work properly.
The LEAFNODE structure element is only used in the bind response structures. It must be a Boolean value that
identifies whether the node is a leaf. If the value is
the node, and users cannot expand the node.
If your bind expression specifies a JavaScript function, the function must use all-uppercase letters for the field names;
for example, use
and
VALUE
names. ColdFusion is not case-sensitive, so CFCs can use lowercase letters for the field names; JavaScript is case-
sensitive, so the JavaScript function must match the uppercase field names.
If you use a URL to get the tree items from a CFML page, you can use the
to JSON format. If the array with the tree items is named itemsArray, for example, the following line specifies the page
output:
<cfoutput>#serializeJSON(itemsArray)#</cfoutput>
Example 1: a simple tree
The following simple example creates a simple hierarchical tree of unlimited depth, with one node per level. Each node
label (specified by the
display
The following example shows the CFML page:
<cfform name="testform">
<cftree name="t1" format="html">
<cftreeitem bind="cfc:makeTree.getNodes({cftreeitemvalue},{cftreeitempath})">
</cftree>
</cfform>
The following example shows the maketree.cfc file with the
Return value
A ColdFusion array of structures. ColdFusion automatically converts the structure to JSON format when it
returns the result to the caller. Alternatively, you can return a JSON representation of the structure.
A JavaScript Array of Objects.
A JSON representation of an array of structures. No other body content is allowed.
, the tree does not show a +/- expansion indicator in front of
true
, not
and
DISPLAY
value
display
attribute) identifies the node depth:
Last updated 1/20/2012
. ColdFusion uses all capital letters in the structure key
serializeJSON
method that is called when the user expands a node:
getNodes
function to convert the array
835

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents