TreeView
The dxTreeView widget is a tree-like representation of textual data.
You can create the widget using one of the following approaches.
jQuery
Use the dxTreeView jQuery plug-in.HTML<div id="treeView"></div>
JavaScriptvar treeViewData = [ { id: 1, parentId: 0, text: "Animals" }, { id: 2, parentId: 1, text: "Cat" }, { id: 3, parentId: 1, text: "Dog" }, { id: 4, parentId: 1, text: "Cow" }, { id: 5, parentId: 2, text: "Abyssinian" }, { id: 6, parentId: 2, text: "Aegean cat" }, { id: 7, parentId: 2, text: "Australian Mist" }, { id: 8, parentId: 3, text: "Affenpinscher" }, { id: 9, parentId: 3, text: "Afghan Hound" }, { id: 10, parentId: 3, text: "Airedale Terrier" }, { id: 11, parentId: 3, text: "Akita Inu" }, { id: 12, parentId: 0, text: "Birds" }, { id: 13, parentId: 12, text: "Akekee" }, { id: 14, parentId: 12, text: "Arizona Woodpecker" }, { id: 15, parentId: 12, text: "Black-chinned Sparrow" } ]; $("#treeView").dxTreeView({ dataSource: treeViewData, dataStructure: 'plain' });
Knockout
Add a div element and apply the dxTreeView binding to this element.HTML<div data-bind="dxTreeView: { dataSource: treeViewData, dataStructure: 'plain' }"></div>
AngularJS
Add a div element and apply the dx-tree-view directive to this element.HTML<div dx-tree-view="{ dataSource: treeViewData, dataStructure: 'plain' }"></div>
Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.
Since the dxTreeView widget is used to display multiple items, it supports common Collection Container widget functionality. You can find detailed information on the principles of working with the widget in the dxTreeView section of the Collection Container Widgets article.
Default Item Template
This section lists the data source fields that are used in a default item template.
By default, a predefined item template is applied to display the items of this widget. This template is based on certain fields of the data source provided for this widget. Below is the list of these fields. If the default item template is not appropriate for your task, implement a custom item template based on these or other fields of your data source.