LoadOnDemand and Checkboxes

4 posts, 0 answers
  1. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 29 Sep 2008 Link to this post

    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
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 30 Sep 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 14 Oct 2008 Link to this post

    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
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 16 Oct 2008 Link to this post

    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.
Back to Top