dTree.js下载+API文档

  dTree 2.05下载,扩展了通过id收缩指定节点的方法。压缩包中的示例增加了查找节点,并展开收缩查找到得节点功能,具体参考:dTree示例,带查找展开收缩节点功能

  dTree API文档

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

mytree.config.target = "mytarget";

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

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

openAll()

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

Example

mytree.openAll();

closeAll()

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

Example

mytree.closeAll();

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

mytree.openTo(4, true);

o(id):切换id指定节点的展开或者收缩状态

closeTo(id):扩展的方法,关闭指定ID的节点

isOpen(id):检查指定ID的节点是否是打开状态

分类:Ajax示例源代码 下载地址
阅读(60)喜欢(0)不喜欢(0)13.84KB浏览器 点击下载