Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rob Oates on Aug 27, 2009 19:00
open dhtmlx forum
tree, pass additional info from server

Hi, I am using the pro version of dhtmlxtree, I am using the dataprocessor to send a link back to the tree thus:

$url=$row['linkname']." [<a href='../../../../cmsadmin/editSections.php?sectionid=".$row['sectionid']."&action=modify' target='loader'>edit</a>]";
                
print("<item id='".$row['item_id']."' text=\"". htmlentities($url)."\" open=\"1\">");

So the tree appears like:

linkname edit

(where the edit part is a clickable link).
However I wish to separate these, and not pass the actual link through the label since it is visible on edit label.

Ideally I want on highlight of the item to activate the link, then clicking again will edit the linkname. I understand I can easily assign an event for onclick, however I need to pass back from the server this link info:

$link=" <a href='../../../../cmsadmin/editSections.php?sectionid=".$row['sectionid']."&action=modify' target='loader'>edit</a>";

for example via

print("<item id='".$row['item_id']."' text=\"". htmlentities($url)."\" open=\"1\" custom=\"".$link."\">");

and then

tree.attachEvent("onClick",function(custom){
//blah blah
});

In short, how can I pass this server generated link info back to the tree and access it invisibly.

Hope this makes sense

cheers
Rob
Answer posted by Alex (support) on Aug 28, 2009 01:45

Hello, 

you can try to use onEdit event handler with setItemText and getItemText to control editor content. For example:

var text = "";
function m_func(state,id,tree,value){
  if(state==0) {
  text = tree.getItemText(id);
  var new_text =text.replace(/<.*/,"")
  tree.setItemText(id,new_text);
  }
  if (state==3) tree.setItemText(id,text)
  return true;
}
tree.attachEvent("onEdit",m_func);