Categories | Question details Back To List | ||
How to add/set custom attributes to an item in Tree Hi, This question is in continuation with the one I asked earlier index.php?s=normal&q=2302&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" newItem.attrs[attr_name]=value; 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. Ex: <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'); newItem.attrs[name]=value; I get the following error. tree._idpull[tree.getSelectedItemId()].attrs has no properties Please help. Thanks Answer posted by Support on Mar 13, 2008 08:55 Please contact us directly at support@dhtmlx.com - and provide your ref. number we will send you an extension to dhtlmxtree, which will provide a set of methods for required functionality |