dTree/API

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< dTree
Revision as of 02:01, 12 January 2011 by Woozle (talk | contribs) (moved dtree/API to dTree/API: the T is capitalized in the code, so I think that must be the official name. This will help distinguish it from the Linux CLI utility "dtree", too.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Functions

add()

Adds a node to the tree.
Can only be called before the tree is drawn.

id, pid and name are required.

Parameters

Name Type Description
id Number Unique identity number.
pid Number Number refering to the parent node. The value for the root node has to be -1.
name String Text label for the node.
url String Url for the node.
title String Title for the node.
target String Target for the node.
icon String Image file to use as the icon. Uses default if not specified.
iconOpen String Image file to use as the open icon. Uses default if not specified.
open Boolean Is the node open.

Example

<javascript>mytree.add(1, 0, 'My node', 'node.html', 'node title', 'mainframe', 'img/musicfolder.gif');</javascript>

openAll()

Opens all the nodes.
Can be called before and after the tree is drawn.

Example

<javascript>mytree.openAll();</javascript>

closeAll()

Closes all the nodes.
Can be called before and after the tree is drawn.

Example

<javascript>mytree.closeAll();</javascript>

openTo()

Opens the tree to a certain node and can also select the node.
Can only be called after the tree is drawn.

Parameters

Name Type Description
id Number Identity number for the node.
select Boolean Should the node be selected.

Example

<javascript>mytree.openTo(4, true);</javascript>

Configuration

Variable Type Default Description
target String true Target for all the nodes.
folderLinks Boolean true Should folders be links.
useSelection Boolean true Nodes can be selected(highlighted).
useCookies Boolean true The tree uses cookies to rember it's state.
useLines Boolean true Tree is drawn with lines.
useIcons Boolean true Tree is drawn with icons.
useStatusText Boolean false Displays node names in the statusbar instead of the url.
closeSameLevel Boolean false Only one node within a parent can be expanded at the same time. openAll() and closeAll() functions do not work when this is enabled.
inOrder Boolean false If parent nodes are always added before children, setting this to true speeds up the tree.

Example

<javascript>mytree.config.target = "mytarget";</javascript>

Copyright

©2002-2003 Geir Landrö