|
Zapatec Utils | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Zapatec.BasicTree
Defined in tree.js
Field Summary | |
<static> Object |
all
This global variable keeps a "hash table" (that is, a plain JavaScript object) mapping ID-s to references to Zapatec.BasicTree objects. |
Constructor Summary | |
Zapatec.BasicTree(el, config)
The Zapatec.BasicTree object constructor. |
Method Summary | |
Object
|
_getTree(tree_id, dont_call)
\internal This function is used when "dynamic initialization" is on. |
void
|
appendChild(parent, newChild, atStart)
Append a child to the start or end of the given parent. |
void
|
collapseAll()
Call this function to collapse all items in the tree. |
Object
|
createItem(li, parent, next_li, level, atStart)
\internal This function walks through a LI element and creates the HTML elements associated with that tree item. |
Object
|
createTree(list, parent, level)
\internal Function that creates a (sub)tree. |
void
|
destroy()
Destroys the tree. |
void
|
expandAll()
Call this function to expand all items in the tree. |
Object
|
getParent(id, mode)
Call to get the parent to append, insert or remove a child either at start or end position or in between two nodes of the (sub-)tree. |
void
|
init(el, config)
|
void
|
insertBefore(newChild, refChild)
A new child can be inserted between two nodes/children or before one node /children at the same tree level. |
void
|
item_addDefaultIcon(item, className)
\internal This function adds a TD element having a certain class attribute which helps having a tree containing icons without defining IMG tags for each item. |
void
|
item_addIcon(item, img)
\internal This function does different things, depending on whether the \b img parameter is passed or not. |
void
|
itemClicked(item_id)
This function gets called from a global event handler when some item was clicked. |
Object
|
makeNode(html, type)
Call this function to create a html element with the optional element type specified. |
void
|
onItemSelect()
Third party code can override this member in order to add an event handler that gets called each time a tree item is selected. |
void
|
removeChild(oldChild)
An old child node in the tree can be removed at any level. |
void
|
sync(item_id)
Call this function to synchronize the tree to a given item. |
void
|
toggleAll()
Call this function to toggle all items in the tree. |
Object
|
toggleItem(item_id, state)
This function toggles an item if the \b state parameter is not specified. |
<static> void
|
onItemToggle()
\internal This is a global event handler that gets called when a tree item is clicked. |
Field Detail |
<static> Object all
Constructor Detail |
Zapatec.BasicTree(el, config)
el
- [string or HTMLElement] -- the UL element
config
- [Object, optional] -- the configuration options
Method Detail |
Object _getTree(tree_id, dont_call)
tree_id
- [string] the ID of the subtree
dont_call
- [boolean] pass true here if you don't want the subtree to be created
void appendChild(parent, newChild, atStart)
parent
- [HTMLElement] -- reference to a tree node (either as a node at top level or at a subtree level) the new child going to be appended to in the tree.
newChild
- [HTMLElement] -- reference to an HTML element created of type LI, to which futher HTML elements such UL and LI can be included to generate subtrees.
atStart
- [boolean, optional] -- true if the child going to be added at the start of the parent.
void collapseAll()
Object createItem(li, parent, next_li, level, atStart)
li
- [HTMLElement] -- reference to the LI element
parent
- [HTMLElement] -- reference to the parent element where the HTML elements should be created
next_li
- [HTMLLiElement] -- reference to the next LI element, if this is not the last one
level
- [integer] -- the level of this item in the main tree
atStart
- [HTMLElement optional] -- reference to the element DIV with a TABLE object that represents the child following the new child added or inserted
Object createTree(list, parent, level)
list
- [HTMLElement] -- reference to the UL element
parent
- [HTMLElement] -- reference to the parent element that should hold the (sub)tree
level
- [integer] -- the level of this (sub)tree in the main tree.
void destroy()
void expandAll()
Object getParent(id, mode)
id
- [String] -- id of the parent the new child will be added to or inserted before/at.
mode
- [String optional] -- "I" is for inserting a child node. "R" is for removing a child node.
void init(el, config)
void insertBefore(newChild, refChild)
newChild
- [HTMLElement] -- New child node to be inserted into the tree
refChild
- [HTMLElement] -- Reference to the child node which the new child node will be inserted before
void item_addDefaultIcon(item, className)
item
- [HTMLElement] -- reference to the DIV element holding the item
className
- -- a string containing the additional class name
void item_addIcon(item, img)
item
- [HTMLElement] -- reference to the DIV holding the item elements
img
- [HTMLImgElement, optional] -- reference to an IMG element; normally one found in the void itemClicked(item_id)
item_id
- [string] -- the item ID
Object makeNode(html, type)
html
- [string, optional] -- html of the node; may include type
- [string, optional] -- type of the node to be created
void onItemSelect()
void removeChild(oldChild)
oldChild
- [HTMLElement] -- Old child node to be removed from the tree where it can be an item node without children or a subtree including the old child node as the root.
void sync(item_id)
item_id
- [string] -- the ID of the item to sync to.
void toggleAll()
Object toggleItem(item_id, state)
item_id
- [string] -- the item ID
state
- [boolean, optional] -- the desired item state
<static> void onItemToggle()
|
Zapatec Utils | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |