Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prasad Welekar on Jul 16, 2008 07:59
open dhtmlx forum
check all child on load

Hi Support,

I have only one higher level node in tree. All child of that node are childless.
Checkbox is enabled .
Now when tree loads the first and only higher level node populates on the page. When I click on the node or + image all child comes from servlet. I want the state(checked or unchecked) of only node in the servlet, when childes are populated. So that I can check all child if parent is checked.

But what my problem is I am not able to pass any parameter to servlet regarding the state of parent.
How to pass that?

OR

Can I have control after tree loads? So that I can run any js code .
I just tried

categoryTree.loadXML(path,myFun());

categoryTree.setXMLAutoLoading(path,myFun());

But it dosent help
How to achieve by both ways?
Thanks
Answer posted by Support on Jul 17, 2008 05:58
You can use the userdata functionality. It can be set for the 1-level item from the xml which contains child items.

For example, the xml with child items is as follows:

<tree id="1">
    <userdata name='checked'>1</userdata>
    <item .../>
    ...
</tree>

And when child item are loaded, the parent item (its id is "1") will be checked:

tree.attachEvent("onXLE",function(id){
    if(tree.getUserData(id,"checked")) tree.setCheck(id,1);
})