Skip to main content


sets a dataset for a tree

data?: array;


var data = new dhx.TreeCollection();data.load("../common/treedata.json");var tree = new dhx.Tree("tree", {data: data});

Related samples:

Each data object can have the following properties:

value(string) the value of an item
id(string, number) the id of an item
opened(boolean) optional, defines whether an item is opened by default
checkbox(boolean) optional, enables/disables displaying a checkbox for a tree item
items(array) an array of children items
icon(object) allows adding custom icons for a tree item
Related sample: Tree. Custom Dataset Icons
var tree = new dhx.Tree("tree", {    data:[        {            "value": "Books",            "id": "Books",            "opened": true,            "checkbox": true,            "items": [                {                    "value": "Thrillers",                    "id": "Thrillers",                    "icon": {                         "folder": "fas fa-book",                         "openFolder": "fas fa-book-open",                         "file": "fas fa-file"                    }                }            ]        }    ]});

You can disable displaying a checkbox for a tree item via the update method of tree collection."Books", {checkbox:false});
  • parent - (string) the id of the parent of a tree item

For example, you can get the parent of an item using the getItem method of tree collection."Thrillers").parent// "Books""Books").parent// "_ROOT_u1574768464563"