JSCookTree Reference

 

stats counter

JSCookTree not only draws trees, but also provides a set of functions that further manipulate the trees generated. This page describes them in detail. It does require some knowledge of JavaScript to use them.

Function Description
ctDraw (id, tree, themeProperty, themePrefix, branchControl, defaultExpandLevel) Parameters
  1. id
    It is the id of the HTML element that would be used to contain the tree.
  2. tree
    It is the menu tree of what user is intended to display.
  3. themeProperty
  4. themePrefix
  5. branchControl
    • 0: no branch control.
    • 1: only one branch is shown for the current tree.
    • 2: only one branch is shown for the all the trees with branch control 2.
  6. defaultExpandLevel
    All tree nodes below defaultExpandLevel are always fully expanded.
Returns
treeIndex
It is the index of the tree being created.
This function draws the tree.
ctCollapseTree (id) Parameters
  1. id
    It is the id of the HTML element that contains the tree.
Returns
none
This function collapses the tree.
ctExpandTree (id, expandLevel) Parameters
  1. id
    It is the id of the HTML element that contains the tree.
  2. expandLevel
    Up to expandLevel of tree nodes are expanded. The nodes can be collapsed later.
Returns
none
This function expands the tree. It does not work with branch control.
ctExposeItem (treeIndex, link) Parameters
  1. treeIndex
    It is returned by ctDraw function.
  2. link
    It is the third field of a tree node.
Returns
treeItem
It is the table row of where the tree item is located.
This function expands the tree so that the item specified by the user is exposed and selected. Tree branch control will take effect if the tree uses it.
ctExposeTreeIndex (treeIndex, itemIndex) Parameters
  1. treeIndex
    It is returned by ctDraw function.
  2. itemIndex
    It specifies the item index in the tree. The count starts from 0.
Returns
treeItem
It is the table row of where the tree item is located.
This function expands the tree so that the item specified by the user using itemIndex is exposed. Tree branch control will take effect if the tree uses it. This function is similar to ctExposeItem, just used the itemIndex instead of its link to locate the item.
ctGetSelectedItem (treeIndex) Parameters
  1. treeIndex
    It is returned by ctDraw function.
Returns
treeItem
It is the table row of where the tree item is located. null if nothing is selected.
This function returns the treeItem object that is been selected for the tree. For trees that use global branch control, this function returns the global item that is selected.
ctMarkItem (treeIndex, link) Parameters
  1. treeIndex
    It is returned by ctDraw function.
  2. link
    It is the third field of a tree node.
Returns
treeItem
It is the table row of where the tree item is located.
This function only change the item's id to JSCookTreeMarked. It will not work for folder items. The purpose of function is to change the style of the item.
ctMarkTreeIndex (treeIndex, itemIndex) Parameters
  1. treeIndex
    It is returned by ctDraw function.
  2. itemIndex
    It specifies the item index in the tree. The count starts from 0.
Returns
treeItem
It is the table row of where the tree item is located.
This function is similar to ctMarkItem and just used the itemIndex instead of its link to locate the item.
ctOpenFolder (treeItem) Parameters
  1. treeItem
    It is the table row where the tree item is located.
Returns
none
This function expand the tree node at treeItem. You can obtain treeItem by calling ctExposeItem or ctExposeTreeIndex.
ctCloseFolder (treeItem) Parameters
  1. treeItem
    It is the table row where the tree item is located.
Returns
none
This function collapse the tree node at treeItem. You can obtain treeItem by calling ctExposeItem or ctExposeTreeIndex.

 

heng' html

 

 

 

Support This Project

 

SourceForge.net Logo

(c) Copyright 2002-2007 Heng Yuan. All rights reserved.

Valid XHTML 1.0! Valid CSS!