id=0 ?


When I assign id=0 to a tree item, it’s changed to a random id like 0_12069575111948.

Is it not possible to use the id 0?

Kind regards,


By default tree uses ID = 0, as ID of super root item ( virtual top level element, parent of visible hierarchy )
When you adding item to tree with not-unique ID , ID will be automatically changed to unique one.

Basically you can define any other super root ID ( 4th parameter of constructor ) , in such case ID=0 can be used for normal item.

Thanks for the answer. But is this also possible when I use dhtmlXTreeFromHTML()?

When you init tree from HTML markup, it always has 0 as super root ID, it can be changed only by code modification.

dhtmlxtree_start.js, line 24
    var t=new dhtmlXTreeObject(obj,“100%”,“100%”,0);