InCorrect Telerik Documentation sample Code

2 posts, 0 answers
  1. Asankhan
    Asankhan avatar
    4 posts
    Member since:
    Jan 2011

    Posted 13 Jul 2011 Link to this post

    Hi ,

    Found some typo in TreeView sample code on Telerik's documentation ,here the URL, Please update me with the right code snippet.

    http://www.telerik.com/help/aspnet-ajax/treeview-checkboxes-check-uncheck-all-child-nodes.html

    <script type="text/javascript" language="javascript">
     
        function UpdateAllChildren(nodes, checked) {
            var i;
            for (i = 0; i < nodes.get_count(); iif (checkednodes.getNode(icheck();
                }
                elsenodes.getNode(iset_checked(falseif (nodes.getNodei).get_nodesget_count() > 0) {
                    UpdateAllChildren(nodes.getNode(i).get_nodes(), checked);
                }
            }
        }
        function clientNodeChecked(sender, eventArgs) {
            var childNodes = eventArgs.get_node().get_nodes();
            var isChecked = eventArgs.get_node().get_checked();
            UpdateAllChildren(childNodes, isChecked);
        }
     
    </script>
  2. Plamen
    Admin
    Plamen avatar
    3031 posts

    Posted 14 Jul 2011 Link to this post

    Hi Asankhan,

    Thank you for reporting this mistake.

    We will update the help article as soon as possible. By this time here is a working code:
    function UpdateAllChildren(nodes, checked) {
               for (var i = 0; i < nodes.get_count(); i++) {
                   if (checked) {
                          nodes.getNode(i).set_checked(true);
                   }
                   else {
                       nodes.getNode(i).set_checked(false);
     
                   }
                   if (nodes.getNode(i).get_nodes().get_count() > 0) {
                       UpdateAllChildren(nodes.getNode(i).get_nodes(), nodes.getNode(i).get_checked());
                   }
               }
           }
           function clientNodeChecked(sender, eventArgs) {
               var childNodes = eventArgs.get_node().get_nodes();
               var isChecked = eventArgs.get_node().get_checked();
               UpdateAllChildren(childNodes, isChecked);
           }

    Greetings,
    Plamen Zdravkov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top