Check documentation for the latest version of dhtmlxSuite addItem DHTMLX Docs

addItem

adds a new item into TreeView

void addItem(string|number id,string text,string|number parentId,number index);
idstring|numberthe item's id
textstringthe item's text
parentIdstring|numberthe parent's id
indexnumberthe item's index

Example

var myTreeview = new dhtmlXTreeView({
    // treeview conf here
});
 
// adding the root item
myTreeView.addItem("1", "Books"); // id, text
 
// adding a first-level child
myTreeView.addItem("2", "Turned at Dark", "1"); // id, text, pId

See also
Back to top