React TreeList Methods
addColumn(columnOptions)
The column's configuration or a data field for which the column should be created.
addRow()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- TreeList - Add a Row
- editing.allowUpdating
addRow(parentId)
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- TreeList - Add a Row
- editing.allowUpdating
beginCustomLoading(messageText)
Shows the load panel.
Normally, the load panel is invoked automatically while the widget is busy rendering or loading data. Additionally, you can invoke it by calling this method. If you call it without the argument, the load panel displays text specified by the loadPanel.text option. To specify the appearance of the load panel, use the loadPanel object. Once invoked from code, the load panel will not hide until you call the endCustomLoading() method.
See Also
beginUpdate()
Prevents the widget from refreshing until the endUpdate() method is called.
The beginUpdate() and endUpdate() methods prevent the widget from excessive updates when you are changing multiple widget settings at once. After the beginUpdate() method is called, the widget does not update its UI until the endUpdate() method is called.
See Also
byKey(key)
A Promise that is resolved after the data object is loaded. It is a native Promise or a jQuery.Promise when you use jQuery.
The following code shows how to get a data object whose key is 15.
widgetInstance.byKey(15).done(function(dataObject) { // process "dataObject" }).fail(function(error) { // handle error });
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- instance()
cellValue(rowIndex, dataField)
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
The data field, caption, or unique name of the column to which the cell belongs.
cellValue(rowIndex, dataField, value)
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
The data field, caption, or unique name of the column to which the cell belongs.
Call saveEditData() after this method to save the changes:
jQuery
var treeList = $("treeListContainer").dxTreeList("instance"); treeList.cellValue(0, "Position", "CEO"); treeList.saveEditData();
Angular
import { ..., ViewChild } from "@angular/core"; import { DxTreeListModule, DxTreeListComponent } from "devextreme-angular"; // ... export class AppComponent { @ViewChild(DxTreeListComponent) treeList: DxTreeListComponent; updateCell(rowIndex, dataField, value) { this.treeList.instance.cellValue(rowIndex, dataField, value); this.treeList.instance.saveEditData(); } } @NgModule({ imports: [ // ... DxTreeListModule ], // ... })
See Also
cellValue(rowIndex, visibleColumnIndex)
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
cellValue(rowIndex, visibleColumnIndex, value)
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
Call saveEditData() after this method to save the changes:
jQuery
var treeList = $("treeListContainer").dxTreeList("instance"); treeList.cellValue(0, 1, "newValue"); treeList.saveEditData();
Angular
import { ..., ViewChild } from "@angular/core"; import { DxTreeListModule, DxTreeListComponent } from "devextreme-angular"; // ... export class AppComponent { @ViewChild(DxTreeListComponent) treeList: DxTreeListComponent; updateCell(rowIndex, columnIndex, value) { this.treeList.instance.cellValue(rowIndex, columnIndex, value); this.treeList.instance.saveEditData(); } } @NgModule({ imports: [ // ... DxTreeListModule ], // ... })
See Also
clearFilter(filterName)
The method's parameter specifies what type of filter should be cleared. This parameter can have one of the following values:
- "row"
Clears the filter row. - "header"
Clears the header filter. - "filterValue"
Clears the filter builder and the synchronized filtering UI elements. - "search"
Clears the search panel. - "dataSource"
Clears the data source filter defined in the configuration or applied by the filter(filterExpr) method.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- clearFilter()
clearSelection()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- deselectAll()
- deselectRows(keys)
closeEditCell()
Switches the cell being edited back to the normal state. Takes effect only if editing.mode is batch and showEditorAlways is false.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- cancelEditData()
collapseAdaptiveDetailRow()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- isAdaptiveDetailRowExpanded(key)
- expandAdaptiveDetailRow(key)
- columnHidingEnabled
collapseRow(key)
A Promise that is resolved after the row is collapsed. It is a native Promise or a jQuery.Promise when you use jQuery.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- expandRow(key)
columnOption(id)
This method gets the options of the first column found by either of the below:
Name
The unique name of the column.Column Index
The index of the column in the columns array.Data Field
The name of the data source field assigned to the column.Caption
The text displayed in the column header.Service String
One of the following values:"command:edit"
Gets the editing column."command:adaptive"
Gets the adaptive column.Any string matching the following format: "optionName:value"
Here, optionName is one of the column options.
See Also
columnOption(id, optionName)
This method gets the value of an option of the first column found by either of the below:
Name
The unique name of the column.Column Index
The index of the column in the columns array.Data Field
The name of the data source field assigned to the column.Caption
The text displayed in the column header.Service String
One of the following values:"command:edit"
Gets the editing column."command:adaptive"
Gets the adaptive column.Any string matching the following format: "optionName:value"
Here, optionName is one of the column options.
See Also
columnOption(id, optionName, optionValue)
This method sets an option of the first column found by either of the below:
Name
The unique name of the column.Column Index
The index of the column in the columns array.Data Field
The name of the data source field assigned to the column.Caption
The text displayed in the column header.Service String
One of the following values:"command:edit"
Gets the editing column."command:adaptive"
Gets the adaptive column.Any string matching the following format: "optionName:value"
Here, optionName is one of the column options.
NOTEIn command columns, you can change only the width and the visibleIndex. See the Command Columns topic for details.
See Also
columnOption(id, options)
This method changes options of the first column found by either of the below:
Name
The unique name of the column.Column Index
The index of the column in the columns array.Data Field
The name of the data source field assigned to the column.Caption
The text displayed in the column header.Service String
One of the following values:"command:edit"
Gets the editing column."command:adaptive"
Gets the adaptive column.Any string matching the following format: "optionName:value"
Here, optionName is one of the column options.
NOTEIn command columns, you can change only the width and the visibleIndex. See the Command Columns topic for details.
See Also
defaultOptions(rule)
defaultOptions is a static method that the widget class supports. The following code demonstrates how to specify default options for all instances of the TreeList widget in an application executed on the desktop.
jQuery
DevExpress.ui.dxTreeList.defaultOptions({ device: { deviceType: "desktop" }, options: { // Here go the TreeList options } });
Angular
import TreeList from "devextreme/ui/tree_list"; // ... export class AppComponent { constructor () { TreeList.defaultOptions({ device: { deviceType: "desktop" }, options: { // Here go the TreeList options } }); } }
deleteColumn(id)
This method removes the first column found by either of the below:
Name
The unique name of the column.Column Index
The index of the column in the columns array.Data Field
The name of the data source field assigned to the column.Caption
The text displayed in the column header.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- addColumn(columnOptions)
- deleteRow(rowIndex)
deleteRow(rowIndex)
The row's index. Refer to Column and Row Indexes for more information.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- addRow()
- deleteColumn(id)
deselectAll()
A Promise that is resolved after the selection is cleared. It is a native Promise or a jQuery.Promise when you use jQuery.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- clearSelection()
deselectRows(keys)
Array<any>
A Promise that is resolved after selection is cleared. It is a native Promise or a jQuery.Promise when you use jQuery.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Initial and Runtime Selection
- deselectAll()
dispose()
The following code disposes of an TreeList instance that corresponds to the element ID (or reference variable in Angular) and removes the element from the DOM:
jQuery
$("#myTreeList").dxTreeList("dispose"); $("#myTreeList").remove();
Angular
<dx-tree-list #treeListVar id="myTreeList"></dx-tree-list>
import { ..., ViewChild } from "@angular/core"; import { DxTreeListComponent } from "devextreme-angular"; // ... export class AppComponent { @ViewChild("treeListVar") treeList: DxTreeListComponent; removeTreeList (e) { this.treeList.instance.dispose(); document.getElementById("myTreeList").remove(); } }
editCell(rowIndex, dataField)
Switches a cell with a specific row index and a data field to the editing state. Takes effect only if the editing mode is "batch" or "cell".
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
editCell(rowIndex, visibleColumnIndex)
Switches a cell with specific row and column indexes to the editing state. Takes effect only if the editing mode is "batch" or "cell".
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
editRow(rowIndex)
Switches a row with a specific index to the editing state. Takes effect only if the editing mode is "row", "popup" or "form".
The row's index. Refer to Column and Row Indexes for more information.
endCustomLoading()
Hides the load panel.
Normally, the widget hides the load panel automatically once data is ready. But if you have invoked the load panel from code using the beginCustomLoading(messageText) method, you must call the endCustomLoading() method to hide it.
See Also
endUpdate()
Refreshes the widget after a call of the beginUpdate() method.
Main article: beginUpdate()
See Also
expandRow(key)
A Promise that is resolved after the row is expanded. It is a native Promise or a jQuery.Promise when you use jQuery.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- collapseRow(key)
filter()
Gets a filter expression applied to the widget's data source using the filter(filterExpr) method and the DataSource's filter option.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getCombinedFilter()
filter(filterExpr)
Applies a filter to the widget's data source.
Pass an array with the following members to this method:
- The data source field by which data items are filtered.
- The comparison operator. The following operators are available: "=", "<>", ">", ">=", "<", "<=", "startswith", "endswith", "contains", "notcontains".
- The value with which data source field values should be compared.
The filter passed to this method is not reflected in any of the filtering UI elements and is applied before these elements' filters. To clear all filters applied in code and the UI, call the clearFilter() method.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getCombinedFilter()
- filterValue
focus(element)
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getCellElement(rowIndex, visibleColumnIndex)
forEachNode(callback)
Performs a pre-order tree traversal, executing a function on each visited node. Starts traversing from the top level nodes.
forEachNode(nodes, callback)
Performs a pre-order tree traversal, executing a function on each visited node. Starts traversing from the specified nodes.
getCellElement(rowIndex, dataField)
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
The data field, caption, or unique name of the column to which the cell belongs.
The cell's container. An HTML element or a jQuery element when you use jQuery. If the specified row or data field does not exist, the method returns undefined.
getCellElement(rowIndex, visibleColumnIndex)
The index of the row to which the cell belongs. Refer to Column and Row Indexes for more information.
The cell's container. An HTML element or a jQuery element when you use jQuery. If the specified row or column does not exist, the method returns undefined.
getCombinedFilter()
Use this method to get the total filter. This filter combines filters applied using filtering UI elements and the filter(filterExpr) method. Note that the total filter contains getters. To get the total filter containing data fields, call the getCombinedFilter(returnDataField) method.
See Also
getCombinedFilter(returnDataField)
Use this method to get the total filter. This filter combines filters applied using filtering UI elements and the filter(filterExpr) method.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getCombinedFilter()
getInstance(element)
getInstance is a static method that the widget class supports. The following code demonstrates how to get the TreeList instance found in an element with the myTreeList
ID:
// Modular approach import TreeList from "devextreme/ui/tree_list"; ... let element = document.getElementById("myTreeList"); let instance = TreeList.getInstance(element) as TreeList; // Non-modular approach let element = document.getElementById("myTreeList"); let instance = DevExpress.ui.dxTreeList.getInstance(element);
See Also
getKeyByRowIndex(rowIndex)
The row's visible index. Refer to Column and Row Indexes for more information.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getRowIndexByKey(key)
getNodeByKey(key)
The Node object; undefined if nothing found.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Node Structure
getRootNode()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Node Structure
getRowElement(rowIndex)
The row's visible index. Refer to Column and Row Indexes for more information.
Note that if the widget has fixed columns, the method returns an array of two separate elements: with unfixed and with fixed columns.
See Also
getRowIndexByKey(key)
The row's index; -1 if nothing found. Refer to Column and Row Indexes for more information.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getKeyByRowIndex(rowIndex)
getScrollable()
For information on API members of the scrollable part, refer to the ScrollView section, but bear in mind that several members described there are unavailable. Those are the following.
Options:
- pullingDownText
- pulledDownText
- refreshingText
- reachBottomText
- onPullDown
- onReachBottom
Methods:
- release(preventScrollBottom)
- refresh()
See Also
getSelectedRowKeys()
Gets the keys of the rows selected explicitly via the API or via a click or tap.
Array<any>
See Also
- getSelectedRowKeys(mode)
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
getSelectedRowKeys(leavesOnly)
Use the getSelectedRowKeys(mode) method instead.
Array<any>
getSelectedRowKeys(mode)
Array<any>
Below is an example of a TreeList with several selected rows:
The getSelectedRowKeys(mode) method called for this TreeList returns different results depending on the mode argument:
"all"
Returns all the selected rows' keys.getSelectedRowKeys("all") // returns [2, 5, 8, 9, 6, 10, 4]
"excludeRecursive"
Excludes recursively selected rows' keys.getSelectedRowKeys("excludeRecursive") // returns [2, 6, 10, 4]
"leavesOnly"
Returns only leaves' keys.getSelectedRowKeys("leavesOnly") // returns [8, 9, 6, 10, 4]
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getSelectedRowsData(mode)
getSelectedRowsData()
Gets the data objects of the rows selected explicitly via the API or via a click or tap.
Array<any>
See Also
getSelectedRowsData(mode)
Array<any>
Below is an example of a TreeList with several selected rows:
The getSelectedRowsData(mode) method called for this TreeList returns different results depending on the mode argument:
"all"
Returns all the selected rows' data objects.getSelectedRowsData("all") // returns data objects with the following keys: 2, 5, 8, 9, 6, 10, and 4
"excludeRecursive"
Excludes recursively selected rows' data objects.getSelectedRowsData("excludeRecursive") // returns data objects with the following keys: 2, 6, 10, and 4
"leavesOnly"
Returns only leaves' data objects.getSelectedRowsData("leavesOnly") // returns data objects with the following keys: 8, 9, 6, 10, and 4
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getSelectedRowKeys(mode)
getVisibleColumns()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getVisibleColumns(headerLevel)
- columns
getVisibleColumns(headerLevel)
Gets all visible columns at a specific hierarchical level of column headers. Use it to access banded columns.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getVisibleColumns()
- columns
getVisibleRows()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Row Structure
- getVisibleColumns()
hasEditData()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- saveEditData()
- cancelEditData()
hideColumnChooser()
Hides the column chooser.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- showColumnChooser()
isAdaptiveDetailRowExpanded(key)
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- expandAdaptiveDetailRow(key)
- collapseAdaptiveDetailRow()
- columnHidingEnabled
loadDescendants()
Loads all root node descendants (all data items). Takes effect only if data has the plain structure and remoteOperations | filtering is true.
A Promise that is resolved after data is loaded. It is a native Promise or a jQuery.Promise when you use jQuery.
loadDescendants(keys)
Loads a specific node's descendants. Takes effect only if data has the plain structure and remoteOperations | filtering is true.
Array<any>
A Promise that is resolved after data is loaded. It is a native Promise or a jQuery.Promise when you use jQuery.
loadDescendants(keys, childrenOnly)
Loads all or only direct descendants of specific nodes. Takes effect only if data has the plain structure and remoteOperations | filtering is true.
A Promise that is resolved after data is loaded. It is a native Promise or a jQuery.Promise when you use jQuery.
option()
See Also
- Get and Set Options
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
option(optionName)
See Also
- Get and Set Options
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
option(optionName, optionValue)
See Also
- Get and Set Options
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
option(options)
See Also
- Get and Set Options
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
pageCount()
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Paging - API
pageIndex()
When the scrolling mode is "virtual", this method returns the index of the page whose row is shown first in the widget.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Paging - API
pageIndex(newIndex)
A Promise that is resolved after the page is shown. It is a native Promise or a jQuery.Promise when you use jQuery.
pageSize(value)
Sets the page size.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Paging - API
refresh()
A Promise that is resolved after data is loaded. It is a native Promise or a jQuery.Promise when you use jQuery.
The widget cannot track changes made in the data source by a third party. To bring data in the widget up to date in this case, call this method. Data sources of lookup columns will be updated along with the main data source.
See Also
repaintRows(rowIndexes)
Row indexes. Refer to Column and Row Indexes for more information.
This method updates the row objects and their visual representation.
See Also
saveEditData()
A Promise that is resolved after changes are saved in the data source. It is a native Promise or a jQuery.Promise when you use jQuery.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- cancelEditData()
- hasEditData()
- onRowInserted
- onRowUpdated
- onRowRemoved
searchByText(text)
Seeks a search string in the columns whose allowSearch option is true.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- getCombinedFilter()
- searchPanel
selectAll()
A Promise that is resolved after all rows are selected. It is a native Promise or a jQuery.Promise when you use jQuery.
If a filter is applied, this method selects only those rows that meet the filtering conditions.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- selectRows(keys, preserve)
- selection
selectRows(keys, preserve)
A Promise that is resolved after the rows are selected. It is a native Promise or a jQuery.Promise when you use jQuery.
By default, this method call clears selection of previously selected rows. To keep these rows selected, call this method with true as the second argument.
widgetInstance.selectRows([5, 10, 12], true);
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- Initial and Runtime Selection
- selectRowsByIndexes(indexes)
selectRowsByIndexes(indexes)
A Promise that is resolved after the rows are selected. It is a native Promise or a jQuery.Promise when you use jQuery.
showColumnChooser()
Shows the column chooser.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- hideColumnChooser
state()
The following example shows how to save the widget state in the local storage and load it from there:
jQuery
$(function () { var treeList = $("#treeListContainer").dxTreeList({ // ... }).dxTreeList; $("#save").dxButton({ text: "Save State", onClick: function() { var state = treeList.state(); // Saves the state in the local storage localStorage.setItem("treeListState", JSON.stringify(state)); } }); $("#load").dxButton({ text: "Load State", onClick: function() { let state = JSON.parse(localStorage.getItem("treeListState")); treeList.state(state); } }); });
Angular
import { Component, ViewChild } from "@angular/core"; import { DxTreeListModule, DxButtonModule, DxTreeListComponent } from "devextreme-angular"; // ... export class AppComponent { @ViewChild(DxTreeListComponent) treeList: DxTreeListComponent saveState() { let state = this.treeList.instance.state(); // Saves the state in the local storage localStorage.setItem("treeListState", JSON.stringify(state)); } loadState() { let state = JSON.parse(localStorage.getItem("treeListState")); this.treeList.instance.state(state); } } @NgModule({ imports: [ DxTreeListModule, DxButtonModule, // ... ], // ... })
<dx-tree-list ...> </dx-tree-list> <dx-button text="Save State" (onClick)="saveState()"> </dx-button> <dx-button text="Load State" (onClick)="loadState()"> </dx-button>
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- stateStoring
state(state)
See an example in the state() method.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- stateStoring
undeleteRow(rowIndex)
Recovers a row deleted in batch editing mode.
The row's index. Refer to Column and Row Indexes for more information.
See Also
- Call Methods: jQuery | Angular | AngularJS | Knockout | Vue | React | ASP.NET MVC
- closeEditCell()
- cancelEditData()
If you have technical questions, please create a support ticket in the DevExpress Support Center.