Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 839

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Using HTML trees
An HTML cftree tag creates an Ajax-based tree data representation that you can populate from a query or a bind
expression. The behavior with a query is equivalent to the behavior of applet or Flash trees. Bind expressions let you
populate the tree based on the values of other controls or Spry data sets. Also, when you use a bind expression, the tree
loads dynamically, getting only the data required for the current display.
Populating the tree using a bind expression
You use the
attribute and bind expressions to dynamically and incrementally load and display tree data as the
bind
user navigates the tree. The child tree items do not exist until the parent node expands. This behavior avoids prefilling
a tree with large amounts of data. It lets the tree children change dynamically (you can optionally get the children each
time the item expands) and can enhance application responsiveness.
For more information about binding and bind parameters, see
Bind expressions in trees work in the following ways:
• If you use a bind expression, the
called by the bind expression must be able to populate all levels of the tree.
• When a tree item expands, the CFC or JavaScript function or active page specified by the
array with the values for the child nodes of the item. The dynamic tree code on the client constructs the child items
by using these values.
• When a control to which the tree is bound generates an event that the tree is listening for, the tree is refreshed. For
example, if the tree uses a bind expression that includes a select box as a bind parameter, the tree collapses to the
root nodes when the selected value in the select box changes.
When you use a bind expression to populate a
and pass the following bind parameters. If you omit either of the parameters from your function call or URL, you get
an error. These parameters provide information about the tree and its state, and are automatically provided by the
control.
Bind parameter
{cftreeitempath}
{cftreeitemvalue}
The called function or URL cannot return nested arrays and structures, that is, it can only return a single level of items.
When a function or URL is first called to populate the root-level tree items, the value passed in the cftreeitemvalue
variable is the empty string. Your bind function can test for an empty string to determine that it is populating the root
level of the tree.
The
event specifier is also useful if you use the ColdFusion.Tree.refresh JavaScript function to manually refresh
@none
the tree. When you call the
Refresh
parameters. If you specify
@none
automatically to changes in the other controls, but it does pick up data from the bind parameters when you use the
ColdFusion.Tree.Referesh
The format of the data that the function or URL in a bind expression must return depends on the type of bind
expression
tag can have only a single
cftree
control, specify a CFC function, JavaScript function, or URL,
cftree
Description
Passes the path of the current (parent) node to the method, which uses it to generate the next node.
Passes the current tree item value (normally the
function, the bind expression fetches data from all bind parameters, including
in all bind parameters that specify other controls, the tree does not respond
@none
function to explicitly refresh the tree.
Last updated 1/20/2012
"Binding data to form
fields" on page 860.
tag. Therefore, the function or URL
cftreeitem
value
attribute)
834
attribute returns an
bind

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents