Newbie question here. How do I get the currently selected node? Also, I want to check a node and it’s children. I’ve seen the example but I can’t really figure out where to start my selection.
I need something like this;
var node = tree.nodes[tree.getSelectedItemId()] // need real way
for(i=0;i<node.childNodes.length;i++)
{
tree.setCheck(node.childNodes[i], 1)
}
Also, is it possible to fire this event from the checked checkbox itself?
Can be done as
var childs = tree.getSubItems(tree.getSelectedItemId()).split(",");
for(i=0;i<childs.length;i++) {
tree.setCheck(childs[i], 1)
}
>>Also, is it possible to fire this event from the checked checkbox itself?
xtree.attachEvent(“onCheck”,function(id){
//any code here
return true;
});
Actually dhtmlxtree supports 3-state checkboxes , which work in such way without any custom code used.
var childs = tree.getSubItems(tree.getSelectedItemId()).split(",") throws error in javascript console of firefox: "split is not a function"
you don’t have to call the split() function at all. it works without.