How to add/set custom attributes to an item in Tree


This question is in continuation with the one I asked earlier … 302&a=2914

My problem is that I want to add new attributes to a node which I am creating using the insertNewItem method.
When I create a node the above function only accept the default image icons, I want to add more attributes to it like attr1=“1” attr2=“2” attr3="3"


The above code snippet is useful only when I have a node which already has an attribute "attr_name.

My issue is how to create such a node in the first place, so that it contains these attributes.
insertNewItem according my knowledge does not allow me to create node which has user defined attributes.

<item text=“ABS” id=“ABS” isGroup=“0” im0=“leaf.gif” im1=“leaves.gif” im2=“leaf.gif” attr1=“1” attr2=“2” attr3=“3”/>
attributes in RED are the attributes which I want to add to my item, when ever I create an item.

When I try to just create a node and set value for its attribute

var newItem=tree.insertNewItem(tree.getSelectedItemId(),44353,document.getElementById(‘newGroupNameTxt’).value,0,“folderClosed.gif”,“folderOpen.gif”,“folderClosed.gif”,‘SELECT’);

I get the following error.
tree._idpull[tree.getSelectedItemId()].attrs has no properties

Please help.


Please contact us directly at - and provide your ref. number we will send you an extension to dhtlmxtree, which will provide a set of methods for required functionality