DHTMLX Docs & Samples Explorer

dhtmlxTree API Methods

dhtmlXTreeObject Object

assignKeys configures keys used for keyboard navigation

attachEvent adds any user-defined handler to available events

changeItemId changes item id

clearCut clears cut

clearSelection unselects item in tree

closeAllItems collapses target node and all sub nodes

closeItem collapses node

defineItemForm assigns custom form to tree

deleteChildItems deletes all children of node

deleteItem deletes node

destructor deletes tree and clears memory

detachEvent removes an event handler

disableCheckbox disables checkbox

doCut marks selected item as cut

doPaste inserts previously cut branch

editItem opens editor for specified item

enableActiveImages enables active images (clickable and dragable). By default only text part of the node is active

enableAutoSavingSelected enables/disables autosaving selected node in cookie

enableAutoTooltips enables auto tooltips (node text as tooltip)

enableCheckBoxes shows/hides checkboxes (all checkboxes in tree)

enableContextMenu enables context menu

enableDistributedParsing enables distributed parsing of big tree (items loaded portion by portion with some timeouts)

enableDragAndDrop enables/disables drag-and-drop

enableDragAndDropScrolling enables/disables auto scrolling while drag-and-drop

enableHighlighting enables item highlighting (item text highlited on mouseover)

enableIEImageFix replaces IMG tag with background images - solve problem with IE image caching , not works for IE6 SP1

enableImageDrag enables draging item image with item text

enableItemEditor enables editing of item text

enableKeySearch enables search items by pressing keys (any item in tree should be focused/selected to make search work)

enableKeyboardNavigation enables keyboard navigation in tree

enableLoadingItem enables/disables “Loading…” item

enableMercyDrag enables drag without removing (copy instead of move)

enableMultiLineItems enables multi line items

enableMultiselection enables multiselection

enableRTL enables Right-to-Left mode in tree

enableRadioButtons replaces checkboxes with radio buttons

enableSingleRadioMode replaces checkboxes with radio buttons

enableSmartCheckboxes enables smart checkboxes ,true by default (auto checking children and parents for 3-state checkboxes)

enableSmartRendering enables smart rendering mode (usefull for big trees with lots f items on each level)

enableSmartXMLParsing enables/disables smart XML parsing mode (usefull for big, well structured XML)

enableTextSigns replaces images with text signs

enableThreeStateCheckboxes enables three state checkboxes

enableTreeImages enables tree images

enableTreeLines enables/disables tree lines (parent-child threads)

findItem finds tree item by text, select and focus it

findItemIdByLabel finds tree item by text

focusItem focuses item in tree (scroll to it if necessary)

getAllChecked returns list of identificators of nodes with checked checkboxes, separated by default delimiter

getAllCheckedBranches returns list of identificators of nodes with checked and third state checkboxes, separated by default delimiter

getAllChildless returns the list of all items which doesn't have child nodes.

getAllItemsWithKids returns the list of all items which have child nodes, separated by default delimiter.

getAllPartiallyChecked returns list of identificators of nodes with third state checkboxes, separated by default delimiter

getAllSubItems returns the list of all children from all next levels of tree, separated by default delimiter.

getAllUnchecked returns list of identificators of nodes with unchecked checkboxes, separated by default delimiter

getChildItemIdByIndex returns child node id by index

getDistributedParsingState gets current state of distributed parsing

getIndexById returns node index in children collection by Id

getItemColor gets node color (text color)

getItemIdByIndex returns node id by index

getItemImage gets url of item image

getItemParsingState gets current parsing state of item

getItemText returns node text

getItemTooltip gets item's tooltip

getLevel gets node level (position in hierarchy)

getOpenState returns open/close state

getParentId returns parent item id

getSelectedItemId returns selected item id

getSelectedItemText returns selected node text

getSubItems returns the list of all subitems Ids from the next level of tree, separated by commas.

getUserData gets user data from target node

getXMLState returns current state of XML loading

hasChildren returns number of children

hideItemForm hides item's form

insertNewChild creates new node as a child to specified with parentId

insertNewNext creates new node next to specified

isItemChecked gets state of nodes's checkbox

isLocked gets locked state of item

loadCSV loads tree from csv file|stream

loadCSVString loads tree from csv string

loadJSArray loads tree from js array object

loadJSArrayFile loads tree from js array file|stream

loadJSON loads tree from json file

loadJSONObject loads tree from json object

loadOpenStates restores open nodes from cookie

loadState loads tree from cookie

loadXML loads tree from xml file

loadXMLString loads tree from xml string

lockItem locks/unlocks item

lockTree locks tree

makeAllDraggable adds drag-n-drop capabilities (with possibility to drop into dhtmlxTree) to all HTML items with dragInDhtmlXTree attribute

makeDraggable adds drag-n-drop capabilities (with possibility to drop into dhtmlxTree) to HTML object.

moveItem moves item (inside of tree)

openAllItems expands target node and all sub nodes

openAllItemsDynamic expands target node and all child nodes (same as openAllItems, but works in dynamic trees)

openItem expands node

openItemsDynamic expands list of nodes in dynamic tree (wait of loading of node before expanding next)

openOnItemAdded configures if parent node will be expanded immideatly after child item added

preventIECaching prevents caching in IE by adding random value to URL string

refreshItem refreshes tree branch from xml (XML with child nodes rerequested from server)

refreshItems refreshes specified tree nodes (get XML from server and updat only nodes included in itemIdList)

registerXMLEntity registers XML entity for replacement while initialization (default are: ampersand, lessthen and greaterthen symbols)

restoreSelectedItem restores selected item from cookie

saveOpenStates saves open nodes to cookie

saveSelectedItem saves selected item to cookie

saveState saves tree to cookie

selectItem selects node ( and optionaly fire onselect event)

serializeTree gets xml representation (as string) of tree

serializeTreeToJSON returns tree as json string

setCheck sets state of node's checkbox

setChildCalcHTML sets children calculation prefix and postfix

setChildCalcMode sets children calculation mode

setCustomSortFunction sets custom sort functions, which has two parametrs - id_of_item1,id_of_item2

setDataMode sets default data transfer mode

setDragBehavior sets Drag-And-Drop behavior (child - drop as chils, sibling - drop as sibling, complex - complex drop behaviour )

setEditStartAction defines which events must start editing

setEscapingMode sets escaping mode (used for escaping ID in requests)

setFormAppearOn defines events for form appearing

setFormDisappearOn defines events for form disappearing

setIconPath sets path to external images used as tree icons

setIconSize sets size of icons

setImageArrays sets images used for parent-child threads drawing (lines, plus, minus)

setImagePath sets path to images directory

setItemCloseable prevents node from closing

setItemColor sets node text color

setItemContextMenu sets context menu to individual nodes

setItemImage sets item icons (mostly usefull for childless nodes)

setItemImage2 sets item images

setItemStyle sets individual item style

setItemText sets new node text (HTML allowed)

setItemTopOffset sets top offset for item

setListDelimeter sets list separator (”,” by default)

setLockedIcons sets icon for locked items

setOnDblClickHandler sets function called when tree node double clicked

setOnFormDismissal allows to set user routine which will be called right before form disappears

setOnFormInitialisation allows setting user routine which will be called immideatly before form appears

setSerializationLevel configures XML serialization

setStdImages sets default images for nodes (must be called before XML loading)

setSubChecked changes state of node's checkbox and all children checkboxes

setUserData sets user data for target node

setXMLAutoLoading enables dynamic loading from XML

setXMLAutoLoadingBehaviour defines which script be called on dynamic loading

showItemCheckbox shows/hides checkbox for tree item (works only for individual items, not for entire tree )

showItemForm shows item's form

showItemSign shows/hides (+/-) icon (works only for individual items, not for entire tree )

smartRefreshBranch refreshes specified tree branch (get XML from server, add new nodes, remove not used nodes)

smartRefreshItem refreshes specified tree item (get XML from server, add new nodes, remove not used nodes)

sortTree reorders items in tree according to their text

stopEdit switches currently edited item back to normal view

updateItem updates item properties