Tree: how to add and retrieve custom attribute values in a t

tree: how to add and retrieve custom attribute values in a tree?


You can use getAttribute and setAttribute methods (dhtmlxtree_attrs.js should be included):


tree.setAttribute(id,attr_name,attr_value);


var attr_value = tree.getAttribute(id,attr_name);

where can i find the dhtmlxtree_attrs.js file?
Also i didnot see tree.setAttribute(id,attr_name,attr_value); and tree.getAttribute(id,attr_name); functions in the given API


>> Also i didnot see tree.setAttribute(id,attr_name,attr_value); and tree.getAttribute(id,attr_name); functions in the given API


There methods are missed. We’ll add them


>> where can i find the dhtmlxtree_attrs.js file?


This extension is available only in the PRO edition: dhtmlxTree/codebase/ext/dhtmlxtree_attrs.js

I initialize my trees from xml. After trying to use the getAttribute method, I noticed that it doesn’t work for attributes defined in the xml. It only works if I use setAttribute first. What I’d like to do is define my xml like this…

Then I’d like to use getAttribute(id, “attr1”) and have it return “abc” in this case. Does this functionality exist? Thanks in advance.

Nevermind. I figured out that I can use the getUserData method for retrieving the data that I need to retrieve.