# dhtmlxtree:api_toc_categories [DHX documentation]

DHTMLX Docs & Samples Explorer

Index
dhtmlxtree
Appearance

### Appearance

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

enableLoadingItem enables/disables “Loading…” item

enableMultiLineItems enables multi line items

enableTextSigns replaces images with text signs

enableTreeImages enables tree images

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

setIconSize sets size of icons

setItemColor sets node text color

setItemImage sets item icons (mostly usefull for childless nodes)

setItemImage2 sets item images

setItemStyle sets individual item style

setItemTopOffset sets top offset for item

setLockedIcons sets icon for locked items

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

### Checkboxes

disableCheckbox disables checkbox

enableCheckBoxes shows/hides checkboxes (all checkboxes 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)

enableThreeStateCheckboxes enables three state checkboxes

setCheck sets state of node's checkbox

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

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

### Configuration

attachEvent adds any user-defined handler to available events

destructor deletes tree and clears memory

detachEvent removes an event handler

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

enableAutoTooltips enables auto tooltips (node text as tooltip)

enableContextMenu enables context menu

enableRTL enables Right-to-Left mode in tree

lockTree locks tree

setChildCalcHTML sets children calculation prefix and postfix

setChildCalcMode sets children calculation mode

setEditStartAction defines which events must start editing

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

setIconPath sets path to external images used as tree icons

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

setImagePath sets path to images directory

setItemContextMenu sets context menu to individual nodes

setListDelimeter sets list separator (”,” by default)

setOnDblClickHandler sets function called when tree node double clicked

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

### Cookies

enableAutoSavingSelected enables/disables autosaving selected node in cookie

restoreSelectedItem restores selected item from cookie

saveOpenStates saves open nodes to cookie

saveSelectedItem saves selected item to cookie

saveState saves tree to cookie

### Data Loading

defineItemForm assigns custom form to tree

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

enableLoadingItem enables/disables “Loading…” item

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)

hideItemForm hides item's form

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

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)

setDataMode sets default data transfer mode

setXMLAutoLoading enables dynamic loading from XML

setXMLAutoLoadingBehaviour defines which script be called on dynamic loading

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)

setFormAppearOn defines events for form appearing

setFormDisappearOn defines events for form disappearing

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

setUserData sets user data for target node

showItemForm shows item's form

serializeTree gets xml representation (as string) of tree

serializeTreeToJSON returns tree as json string

setSerializationLevel configures XML serialization

### Drag-and-Drop

enableDragAndDrop enables/disables drag-and-drop

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

enableImageDrag enables draging item image with item text

enableMercyDrag enables drag without removing (copy instead of move)

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)

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

### Get-methods

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

### Items manipulation

changeItemId changes item id

clearCut clears cut

closeAllItems collapses target node and all sub nodes

closeItem collapses node

deleteChildItems deletes all children of node

deleteItem deletes node

doCut marks selected item as cut

doPaste inserts previously cut branch

editItem opens editor for specified item

enableItemEditor enables editing of item text

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

lockItem locks/unlocks item

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

setCheck sets state of node's checkbox

setItemCloseable prevents node from closing

setItemText sets new node text (HTML allowed)

stopEdit switches currently edited item back to normal view updateItem updates item properties

### Selection, Sorting, Navigation

assignKeys configures keys used for keyboard navigation

clearSelection unselects item in tree

enableKeyboardNavigation enables keyboard navigation in tree

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

findItem finds tree item by text, select and focus it

findItemIdByLabel finds tree item by text

enableMultiselection enables multiselection

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

selectItem selects node ( and optionaly fire onselect event)

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

sortTree reorders items in tree according to their text