Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by E Leonard on Apr 24, 2008 05:52
open dhtmlx forum
dhtmlx Tree [Professionial version] catch ID when inserting new node with data processor

Hi there,

I have a question regarding dhtmlxtree

When I do
tree.insertNewItem(selectedId,100,newCategoryTitle,0,'folderClosed.gif','folderClosed.gif','folderClosed.gif',"SELECT");

how do I get the tid in xml response?
<!-- response xml -->
<data>
<action type='insert' sid='89' tid='89'/>
</data>

I tried to catch it with variable, and when I alert it, it didnt' give me the xml for some reason. or maybe i shouldn't have done that.

I need to get the ID just like mysql_insert_id() in php, to set some attributes on it.

Any help would be appreciated

Thanks
Answer posted by Support on Apr 24, 2008 06:04
You can use next code

dataproc.defineAction("insert",function(node){
    alert("new node id = "+node.getAttribute("tid"));
    return true;
});
Answer posted on Apr 24, 2008 06:46
fab - you're a star, thanks :D