expand collaps

## dhtmlXTreeGridObject object API

### Initialization

loadXML(file)
load tree from xml file
- file - link to XML file
loadXMLString(xmlString)
load tree from xml string
- xmlString - XML string
setXMLAutoLoading(filePath)
enables dinamic loading from XML mode
- filePath - name of script returning XML;

### Add/delete

addRow(parentId,itemId,data,itemActionHandler,image1,image2,image3)
add row to grid
- parentId - parent node id
- itemId - new node id
- data - array of row data
- itemActionHandler - function fired on node select event (optional)
- image1 - image for node without childrens; (optional)
- image2 - image for closed node; (optional)
- image3 - image for opened node (optional)
deleteRow(itemId)
delete row of grid
- itemId - item id

### Data manipulation

getGridData(itemId,index)
get data from specefied row by index
- itemId - item id
- index - column index
setGridData(itemId,index,newValue)
set data in specefied row by index
- itemId - item id
- index - column index
- newValue - new grid value

## dhtmlXTreeObject object API

### Initialization

enableCheckBoxes(mode)
hide checkboxes
enableDragAndDrop(mode)
enable/disable drag-and-drop
setDragHandler(func)
set function called when drag-and-drap event occured
- aFunc - event handling function
setImagePath( newPath )
set path to image directory
- newPath - path to image directory
setOnCheckHandler(func)
set function called before checkbox checked/unchecked
- func - event handling function
setOnClickHandler(func)
set function called when tree node selected
- func - event handling function
setOnDblClickHandler(func)
set function called when tree node double clicked
- func - event handling function
setOnOpenHandler(func)
set function called before tree node opened/closed
- func - event handling function
setXMLAutoLoading(filePath)
enables dinamic loading from XML mode
- filePath - name of script returning XML;

### Selection control

getChildItemIdByIndex(itemId,index)
retun child node identificator by index
- itemId - parent node identificator
- index - index of child node
getItemIdByIndex(itemId,index)
retun node identificator by index
- itemId - node identificator
- index - index of node
getSelectedItemId()
retun selected node identificator
getSelectedItemText()
retun selected node text
selectItem(itemId,mode)
select node ( and optionaly fire onselect event)
- itemId - node identificator
- mode - If true, script function for selected node will be called.

### Add/delete

clearCut()
clear cut
deleteChildItems(itemId)
delete all child of node
- itemId - node identificator
deleteItem(itemId,selectParent)
delete node
- itemId - node identificator
- selectParent - If true parent of deleted item get selection, else no selected items leaving in tree.
doCut()
mark selected item as cutted
doPaste(itemId)
insert previously cutted branch
- itemId - id of new parent node
insertNewItem(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs)
create new child node
- parentId - parent node id
- itemId - new node id
- itemText - new node text
- itemActionHandler - function fired on node select event (optional)
- image1 - image for node without childrens; (optional)
- image2 - image for closed node; (optional)
- image3 - image for opened node (optional)
- optionStr - options string (optional)
- childs - node childs flag (for dynamical trees) (optional)
insertNewNext(parentItemId,itemId,itemName,itemActionHandler,image1,image2,image3,optionStr,childs)
create new node next to specified
- parentItemId - node id
- itemId - new node id
- itemName - new node text
- itemActionHandler - function fired on node select event (optional)
- image1 - image for node without childrens; (optional)
- image2 - image for closed node; (optional)
- image3 - image for opened node (optional)
- optionStr - options string (optional)
- childs - node childs flag (for dynamical trees) (optional)

### Private

loadXMLString(xmlString)
load tree from xml string
- xmlString - XML string

### Node/level control

changeItemId(itemId,newItemId)
change item id
- itemId - old node id
- newItemId - new node id
closeAllItems(itemId)
collapse target node and all child nodes
- itemId - node id
closeItem(itemId)
collapse node
- itemId - identificator of node
getLevel(itemId)
return node level
- itemId - identificator of node
getParentId(itemId)
return parent node identificator
- itemId - identificator of node
hasChildren(itemId)
return count of childrens
- itemId - identificator of node
openAllItems(itemId)
expand target node and all child nodes
- itemId - node id
openItem(itemId)
expand node
- itemId - identificator of node
setItemCloseable(itemId,flag)
prevent node from closing
- itemId - identificator of node
- flag - if 0 - node can't be closed, else node can be closed

### Checkboxes/user data manipulation

getAllChecked()
return list of identificators of nodes with checked checkboxes
getAllCheckedBranches()
return list of identificators of nodes with checked checkboxes, and parent of that checkboxes
getUserData(itemId,name)
return user data from target node
- itemId - target node identificator
- name - key for user data
isItemChecked(itemId)
return state of nodes's checkbox
- itemId - target node identificator
setCheck(itemId,state)
change state of node's checkbox
- itemId - target node identificator
- state - checkbox state
setSubChecked(itemId,state)
change state of node's checkbox and all childnodes checkboxes
- itemId - target node identificator
- state - checkbox state
setUserData(itemId,name,value)
set user data for target node
- itemId - target node identificator
- name - key for user data
- value - user data

### Appearence control

enableTreeLines(mode)
enableTreeLines(mode);
- mode - enable/disable tree lines
getAllSubItems(itemId)
Returns the list of all children items from all next levels of tree, separated by commas.
- itemId - identificator of node
getItemColor(itemId)
get node color
- itemId - identificator of node
getItemText(itemId)
return node text
- itemId - identificator of node
getSubItems(itemId)
Returns the list of all children items from the next level of tree, separated by commas.
- itemId - identificator of node
refreshItem(itemId)
refresh tree branch from xml
- itemId - identificator of node, if not defined tree super root used.
setImageArrays(arrayName,image1,image2,image3,image4,image5)
enableTreeLines(mode);
- arrayName - name of array: plus, minus
- image1 - line crossed image
- image2 - image with top line
- image3 - image with bottom line
- image4 - image without line
- image5 - single root image
setItemColor(itemId,defaultColor,selectedColor)
set node color
- itemId - identificator of node
- defaultColor - node color
- selectedColor - selected node color
setItemImage(itemId,image1,image2)
set node images
- itemId - identificator of node
- image1 - node without childrens image or closed node image (if image2 specified)
- image2 - open node image (optional)
setItemImage2(itemId, image1,image2,image3)
set node images
- itemId - identificator of node
- image1 - node without childrens image
- image2 - closed node image
- image3 - open node image
setItemText(itemId,newLabel)
set new node text (HTML allowed)
- itemId - identificator of node
- newLabel - node text
setStdImages(image1,image2,image3)
set default images for nodes
- a0 - image for node without childrens;
- a1 - image for closed node;
- a2 - image for opened node