Implementing additional features of a dynamic tree

Within this page you can access information about the following specifics of implementing additional features of a dynamic tree:

Searches

Searches in the dynamic tree are performed using a search path. A search path is the entire path, starting at the tree root, separated by forward slashes. For example, your JavaScript may call the dynamic tree function gotoAndHighlight("Item 1.1/Item 1.1.3/Item 1.1.3.5/Item 1.1.3.5.4") to search for Item 1.1.3.5.4. Your databean must accept the gotoNode parameter, and return a vector which contains all of the nodes from the root through to the level that contains the specified node or leaf. See the Sample populate() function for an example.

Additional URL parameters

The developer may pass any additional URL parameters to the dynamic tree frame and these parameters can be picked up in the custom data bean to provide further control and processing logic. This should be done in a manner similar to

<frame src="/webapp/wcs/tools/servlet/DnamicTreeView?XMLFile=samples.testTree&myParam=myValue" name="tree">

where myParam is the parameter you want to pass and myValue is the value of said parameter. Any additional parameters should be picked up by the setRequestProperties() method in your data bean.

Opening the tree to a specific node

Developers may open the tree to a specific node when the tree first starts by specifying the URL parameter gotoNode=xxxx (where xxxx is the search path) in the original call to the Dynamic Tree frame. This should be of a form similar to:

<frame src="/webapp/wcs/tools/servlet/DynamicTreeView?XMLFile=samples.testTree&gotoNode=Item 1.1/Item 1.1.4" name="tree">

Your databean must return the specified node or leaf or must display "search failed" as soon as the tree is loaded. See the Sample populate function method for a sample of returning a specified node.

Font size and style

Font sizes and style are configurable in the centre.css files found in WC_installdir\web\tools\common directory.

Retrieving the highlighted node

The getHighlightedNode() function returns the currently selected node. For example:

var node = parent.tree.getHighlightedNode();

Once the node is retrieved, the developer has public access to all of the node data, which is the same as the DynamicTreeNode fields. Thus, the developer can programmatically modify this data. However, changes are not reflected outside of the tree unless the changes are also programmatically made by the developer. For example, the following JavaScript code shows the name and value of the currently selected node or leaf:

alert("Node name: " + node.name + "\nNode value: " + node.value);
The implementer may obtain the namePath or valuePath of any node by using getNamePath(node) and getValuePath(node) respectively.

Related concepts

Related tasks