Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by RamaRao R on Jan 13, 2010 04:12
open dhtmlx forum
Adding Tree nodes via context menus

Hello,

I am working on editable tree and trying to  add/delete nodes via context menus.

Used code  for adding nodes:

tree.insertNewItem(tree.getSelectedItemId(),d.valueOf(),'',0,0,0,0,'SELECT');

and

tree.insertNewNext(tree.getSelectedItemId(),d.valueOf(),'',0,0,0,0,'SELECT');

With above code, I can able to add a node where ever I want but that node is NOT in edit mode and not in focus. I am looking for node should be in editable mode immediate after creation.

Please let me know your thoughts.

Thanks,

RamaRao R.

Answer posted by Alex (support) on Jan 13, 2010 06:41

Hello,

tree.enableItemEditor(true); /*requires dhtmlxtree_ed.js*/

var  id = d.valueOf();

tree.insertNewNext(tree.getSelectedItemId(),id,'',0,0,0,0,'SELECT');

tree.selectItem(id);

tree.editItem(id);