query

The name of the cfquery from wich to take the values. Make sure your query results contain the fields defined for the attributes id, parent, contentfield and the other attributes if specified.
When you use DBTree with the query attribute you can fully control the tree's output, sorting order etc. You just create the SQL-query and then use it e.g. like:

<cfquery name="queryname" datasource="dsn" username="username" password="password">
select id-column, parent-column, contentfield-column
from tablename
where ...
order by fistcolumn asc, secondcolumn desc,...
</cfquery>

<cfmodule template="dbtree.cfm"
instancename="instancename" 
query="queryname"
action="get"
type="clicktree"
id="column name"
parent="column name"
url_type="param"
url="index.cfm?id="
url_param="id"
contentfield="title"
titlefield="title">

Example

<cfquery name="myquery" datasource="dsn" username="username" password="password">
select * from dbtreetable where parent_id=0 or parent_id=6 order by sortorder asc
</cfquery>

<cf_dbtree
query="myquery"
action="get"
type="linked"
instancename="list1"
id="id"
parent="parent_id"
contentfield="column name"
url_type="db"
url="link">

The result is a list with nodes wich have parent_id=0 (Rootnode/Toplevel) or parent_id=6 (Manage). This is an easy method to expand a node.

 

Add your comment to this page Add Comment
Join for a free account, or login if you are already a member.