Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jame Chiang on Aug 23, 2009 21:46
open dhtmlx forum
DHTMLXTree, dataprocessor and UserData

DHTMLXTree, dataprocessor and UserData

When I add a node to a tree using the insertNewChild function it triggers a call to my dataprocessor trigger function. How do I pass Userdata To the server side?

var d=new Date();
dhxTree.insertNewChild("0",d.valueOf(),document.getElementById('edarea').value,0,0,0,0,'SELECT');    
dhxTree.setUserData(d.valueOf(),"mail","aa@aa.com")
dhxTree.setUserData(d.valueOf(),"position","manager")
Answer posted by Alex (support) on Aug 24, 2009 00:52

Userdata values are sent to the server with the other data of changed item.

But in case of automatic update the request with inserted item is sent before userdata set.

So, you can use the following approach to pass userdata (dp is dataprocessor object):

dp.setUpdateMode("off");

var d=new Date(); 
dhxTree.insertNewChild("0",d.valueOf(),document.getElementById('edarea').value,0,0,0,0,'SELECT');  
dhxTree.setUserData(d.valueOf(),"mail","aa@aa.com") 
dhxTree.setUserData(d.valueOf(),"position","manager")

dp.sendData();
dp.setUpdateMode("cell"); /*enable auto update for dataprocessor again*/