JavaScript/jQuery TreeView API
See Also
jQuery
Angular
Vue
React
Options
Name | Description |
---|---|
accessKey |
Specifies the shortcut key that sets focus on the UI component. |
activeStateEnabled |
Specifies whether the UI component changes its visual state as a result of user interaction. |
animationEnabled |
Specifies whether or not to animate item collapsing and expanding. |
collapseIcon |
Specifies a custom collapse icon. |
createChildren |
Allows you to load nodes on demand. |
dataSource |
Binds the UI component to data. |
dataStructure |
Notifies the UI component of the used data structure. |
disabled |
Specifies whether the UI component responds to user interaction. |
disabledExpr |
Specifies the name of the data source item field whose value defines whether or not the corresponding UI component item is disabled. |
displayExpr |
Specifies the data field whose values should be displayed. |
elementAttr |
Specifies the global attributes to be attached to the UI component's container element. |
expandAllEnabled |
Specifies whether or not a user can expand all tree view items by the "*" hot key. |
expandedExpr |
Specifies which data source field specifies whether an item is expanded. |
expandEvent |
Specifies the event on which to expand/collapse a node. |
expandIcon |
Specifies a custom expand icon. |
expandNodesRecursive |
Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. |
focusStateEnabled |
Specifies whether the UI component can be focused using keyboard navigation. |
hasItemsExpr |
Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. |
height |
Specifies the UI component's height. |
hint |
Specifies text for a hint that appears when a user pauses on the UI component. |
hoverStateEnabled |
Specifies whether the UI component changes its state when a user pauses on it. |
itemComponent |
An alias for the itemTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information. |
itemHoldTimeout |
The time period in milliseconds before the onItemHold event is raised. |
itemRender |
An alias for the itemTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information. |
items |
An array of items displayed by the UI component. |
itemsExpr |
Specifies which data field contains nested items. Applies only if the dataStructure property is "tree". |
itemTemplate |
Specifies a custom template for items. |
keyExpr |
Specifies which data field provides keys for TreeView items. |
noDataText |
Specifies the text or HTML markup displayed by the UI component if the item collection is empty. |
onContentReady |
A function that is executed when the UI component is rendered and each time the component is repainted. |
onDisposing |
A function that is executed before the UI component is disposed of. |
onInitialized |
A function used in JavaScript frameworks to save the UI component instance. |
onItemClick |
A function that is executed when a collection item is clicked or tapped. |
onItemCollapsed |
A function that is executed when a tree view item is collapsed. |
onItemContextMenu |
A function that is executed when a collection item is right-clicked or pressed. |
onItemExpanded |
A function that is executed when a tree view item is expanded. |
onItemHold |
A function that is executed when a collection item has been held for a specified period. |
onItemRendered |
A function that is executed after a collection item is rendered. |
onItemSelectionChanged |
A function that is executed when a single TreeView item is selected or selection is canceled. |
onOptionChanged |
A function that is executed after a UI component property is changed. |
onSelectAllValueChanged |
A function that is executed when the "Select All" check box value is changed. Applies only if showCheckBoxesMode is "selectAll" and selectionMode is "multiple". |
onSelectionChanged |
A function that is executed when a TreeView item is selected or selection is canceled. |
parentIdExpr |
Specifies the name of the data source item field for holding the parent key of the corresponding node. |
rootValue |
Specifies the parent ID value of the root item. |
rtlEnabled |
Switches the UI component to a right-to-left representation. |
scrollDirection |
A string value specifying available scrolling directions. |
searchEditorOptions |
Configures the search panel. |
searchEnabled |
Specifies whether the search panel is visible. |
searchExpr |
Specifies a data object's field name or an expression whose value is compared to the search string. |
searchMode |
Specifies a comparison operation used to search UI component items. |
searchTimeout |
Specifies a delay in milliseconds between when a user finishes typing, and the search is executed. |
searchValue |
Specifies the current search string. |
selectAllText |
Specifies the text displayed at the "Select All" check box. |
selectByClick |
Specifies whether an item is selected if a user clicks it. |
selectedExpr |
Specifies the name of the data source item field whose value defines whether or not the corresponding UI component items is selected. |
selectionMode |
Specifies item selection mode. Applies only if selection is enabled. |
selectNodesRecursive |
Specifies whether all child nodes should be selected when their parent node is selected. Applies only if the selectionMode is "multiple". |
showCheckBoxesMode |
Specifies the checkbox display mode. |
tabIndex |
Specifies the number of the element when the Tab key is used for navigating. |
useNativeScrolling |
Specifies whether or not the UI component uses native scrolling. |
virtualModeEnabled |
Enables the virtual mode in which nodes are loaded on demand. Use it to enhance the performance on large datasets. |
visible |
Specifies whether the UI component is visible. |
width |
Specifies the UI component's width. |
See Also
Methods
Name | Description |
---|---|
beginUpdate() |
Postpones rendering that can negatively affect performance until the endUpdate() method is called. |
collapseAll() |
Collapses all items. |
collapseItem(itemData) |
Collapses an item with a specific key. |
collapseItem(itemElement) |
Collapses an item found using its DOM node. |
collapseItem(key) |
Collapses an item with a specific key. |
defaultOptions(rule) |
Specifies the device-dependent default configuration properties for this component. |
dispose() |
Disposes of all the resources allocated to the TreeView instance. |
element() |
Gets the root UI component element. |
endUpdate() |
Refreshes the UI component after a call of the beginUpdate() method. |
expandAll() |
Expands all items. If you load items on demand, this method expands only the loaded items. |
expandItem(itemData) |
Expands an item found using its data object. |
expandItem(itemElement) |
Expands an item found using its DOM node. |
expandItem(key) |
Expands an item with a specific key. |
focus() |
Sets focus on the UI component. |
getDataSource() |
Gets the DataSource instance. |
getInstance(element) |
Gets the instance of a UI component found using its DOM node. |
getNodes() |
Gets all nodes. |
getScrollable() |
Gets the instance of the UI component's scrollable part. |
getSelectedNodeKeys() |
Gets the keys of selected nodes. |
getSelectedNodes() |
Gets selected nodes. |
instance() |
Gets the UI component's instance. Use it to access other methods of the UI component. |
off(eventName) |
Detaches all event handlers from a single event. |
off(eventName, eventHandler) |
Detaches a particular event handler from a single event. |
on(eventName, eventHandler) |
Subscribes to an event. |
on(events) |
Subscribes to events. |
option() |
Gets all UI component properties. |
option(optionName) |
Gets the value of a single property. |
option(optionName, optionValue) |
Updates the value of a single property. |
option(options) |
Updates the values of several properties. |
registerKeyHandler(key, handler) |
Registers a handler to be executed when a user presses a specific key. |
repaint() |
Renders the component again without reloading data. Use the method to update the component's markup and appearance dynamically. |
resetOption(optionName) |
Resets a property to its default value. |
scrollToItem(itemData) |
Scrolls the content to an item found using its data. |
scrollToItem(itemElement) |
Scrolls the content to an item found using its DOM node. |
scrollToItem(key) |
Scrolls the content to an item found using its key. |
selectAll() |
Selects all nodes. |
selectItem(itemData) |
Selects a node found using its data object. |
selectItem(itemElement) |
Selects a TreeView node found using its DOM node. |
selectItem(key) |
Selects a node with a specific key. |
unselectAll() |
Cancels the selection of all nodes. |
unselectItem(itemData) |
Cancels the selection of a node found using its data object. |
unselectItem(itemElement) |
Cancels the selection of a TreeView node found using its DOM node. |
unselectItem(key) |
Cancels the selection of a node with a specific key. |
updateDimensions() |
Updates the tree view scrollbars according to the current size of the UI component content. |
Events
Name | Description |
---|---|
contentReady |
Raised when the UI component's content is ready. |
disposing |
Raised before the UI component is disposed of. |
initialized |
Raised only once, after the UI component is initialized. |
itemClick |
Raised when a collection item is clicked or tapped. |
itemCollapsed |
Raised when a tree view item is collapsed. |
itemContextMenu |
Raised when a collection item is right-clicked or pressed. |
itemExpanded |
Raised when a tree view item is expanded. |
itemHold |
Raised when a collection item has been held for a specified period. |
itemRendered |
Raised after a collection item is rendered. |
itemSelectionChanged |
Raised when a tree view item is selected or selection is canceled. |
optionChanged |
Raised after a UI component property is changed. |
selectAllValueChanged |
Raised when the "Select All" check box value is changed. |
selectionChanged |
Raised when a tree view item is selected or selection is canceled. |
Node
This section describes the contents of a TreeView node object. Such objects can be accessed using the getNodes() method and within functions handling the events whose name begins with item....
See Also
Types
Name | Description |
---|---|
ContentReadyEvent |
The type of the contentReady event handler's argument. |
DisposingEvent |
The type of the disposing event handler's argument. |
InitializedEvent |
The type of the initialized event handler's argument. |
ItemClickEvent |
The type of the itemClick event handler's argument. |
ItemCollapsedEvent |
The type of the itemCollapsed event handler's argument. |
ItemContextMenuEvent |
The type of the itemContextMenu event handler's argument. |
ItemExpandedEvent |
The type of the itemExpanded event handler's argument. |
ItemHoldEvent |
The type of the itemHold event handler's argument. |
ItemRenderedEvent |
The type of the itemRendered event handler's argument. |
ItemSelectionChangedEvent |
The type of the itemSelectionChanged event handler's argument. |
OptionChangedEvent |
The type of the optionChanged event handler's argument. |
SelectAllValueChangedEvent |
The type of the selectAllValueChanged event handler's argument. |
SelectionChangedEvent |
The type of the selectionChanged event handler's argument. |
TreeViewCheckBoxMode |
Specifies the checkbox display mode. |
TreeViewExpandEvent |
Specifies the event on which to expand/collapse a node. |
If you have technical questions, please create a support ticket in the DevExpress Support Center.