This is a migrated thread and some comments may be shown as answers.

LoadOnDemand and Checkboxes

3 Answers 77 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Susan
Top achievements
Rank 1
Susan asked on 29 Sep 2008, 10:32 PM
I found the post of where you set the node.checked to that of a parent when loading on demand. I have a treeview with the first level being a sport season (2008 Football), next level the leagues, next level, the teams and the final level, the players. When I 'check' the season and then manually expand the tree, the children get loaded and they are automatically 'checked'. I have a couple of problems from there:
1. What if I don't manually expand the tree. the children are not loaded and therefore my functionality of sending emails out will not work. how do i get the children loaded when i just 'check' the parent?
2. the other problem i noticed is if i do expand and then 'uncheck' say a league, the teams and the players underneath that are still 'checked'. how do i get the children to automatically 'uncheck' when i 'uncheck' a parent.

thanks so much.
susan

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 30 Sep 2008, 04:58 PM
Hello Susan,

If I understood you correctly you want to expand a Node once it is 'checked'. If this is the case you can handle the OnClientNodeChecked event of the TreeView in the following manner:

        function clientNodeChecked(sender, eventArgs) 
        { 
            var node = eventArgs.get_node(); 
             
            if (node.get_checked()) 
            { 
                node.expand(); 
            } 
        } 

The other goal you can achieve by setting the CheckChildNodes property of the TreeView to true. In this way, the children Nodes of a Node will be checked if their parent Node is checked and will be unchecked otherwise.

I hope this helps.

Kind regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Susan
Top achievements
Rank 1
answered on 14 Oct 2008, 03:11 PM
ok, i'm getting closer. the code to expand a node once it is clicked works for the node immediately after it, but i need all of them expanded. i am using load on demand. so if someone clicks 'baseball' which is my root node, i need all of the nodes to load as they are trying to send an email to the entire baseball email list. my understanding is that if the nodes are not 'expanded' they will not be loaded (so called loadondemand, right!!) If i could figure out how to 'load' them without actually 'expanding' them, this would work as well, otherwise, just automatically expanding them would work for me as well.

thanks for your help.
susan
0
Simon
Telerik team
answered on 16 Oct 2008, 05:47 PM
Hello Susan,

I am afraid I do not completely understand what your goal is.

Do you actually need to load Nodes on demand without expanding their parent Node, let say in a JavaScript function? Could you elaborate a bit more on the matter?

Regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Susan
Top achievements
Rank 1
Answers by
Simon
Telerik team
Susan
Top achievements
Rank 1
Share this question
or