Overview

The TreeView widget is a tree-like representation of textual data.

View Demo Watch Video

The following code adds a simple TreeView to your page.

HTML
<div id="treeViewContainer"></div>
JavaScript
$(function() {
    $("#treeViewContainer").dxTreeView({
        dataSource: [{
            id: '1',
            text: 'Fruits',
            expanded: true,
            items: [
                { id: '1_1', text: 'Apples' },
                { id: '1_2', text: 'Oranges' }
            ]
        }, {
            id: '2',
            text: 'Vegetables',
            expanded: true,
            items: [
                { id: '2_1', text: 'Cucumbers' },
                { id: '2_2', text: 'Tomatoes' }
            ]
        }]
    });
});

Note that the data source in the code above has a hierarchical structure, yet data sources with a plain structure are supported as well. To learn how you can customize hierarchical and plain data sources, see the Use Hierarchical Data and Use Plain Data articles.

See Also