Treeview clientside select unselect nodes with checkbox

2 posts, 1 answers
  1. vairam
    vairam avatar
    85 posts
    Member since:
    May 2008

    Posted 18 Jan 2010 Link to this post

    Hi

    I am using Telerik tree view control with checkboxs.
    What i need is when i select the parent node it should select all the child's nodes like wise unselect also.
    I am using this javascript code

    function UpdateAllChildren(nodes, checked)
    {
       var i;

           for (i=0; i<nodes.get_count(); i++)
           {
               if (checked)
               {
                   nodes.getNode(i).check();
               }
               else
               {
                   nodes.getNode(i).set_checked(false);
               }
               
               if (nodes.getNode(i).get_nodes().get_count()> 0)
               {
                   UpdateAllChildren(nodes.getNode(i).get_nodes(), checked);
               }
           }
           if ((nodes.get_count()==0) && (nodes._parent._parent._parent!=null) && (!checked))
           {
            nodes._parent._parent.set_checked(false);
           }
    }
    if the selected node has more than 200 child Nodes (nodes.get_count() > 200) then i am always getting this error

    Stop running  this script a script on this page is causing Internet explore to run slowly.If it continue to run your computer may be unresponsive. How can i avoid this error

    Regards
    Vairamuthu



  2. Answer
    Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 28 Jan 2010 Link to this post

    I think there already is such a functionality in the TreeView. As seen in the CheckBox Support demo there is a property called "CheckChildNodes" which you should set to true!
Back to Top