Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pluca1973 on Oct 30, 2007 04:40
open dhtmlx forum
the method setOnEditHandler on dhtmlXTree

i want to rename a node on the doubleclick event.
i use in my code the tree.enableItemEditor(true); and the setOnEditHandler(m_func) but the last one not existing in the dhtmlXTree_ed.js

since the setOnEditHandler is deprecated i try to use the attachEvent("onEdit",func); but an error is generated on my .jsp ("..property or method not supported by object..").

what i may use to reneme the items in the tree??
thankyou
Answer posted on Oct 30, 2007 09:11
Which version of tree do you use?
The attachEvent available  starting from dhtmlxTree 1.5 and may not be available in older versions - you need to use setOnEditHandler with older version ( meanwhile it still operable with latest code as well, but just not recomended to be used )

tree.enableItemEditor(true);
tree.attachEvent("onEdit",function(){
    //any code here
    return true;
})

Actually to make item editable on dbl click you need just next two lines

tree.enableItemEditor(true);
tree.setEditStartAction(false,true);