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

Treeview clientside select unselect nodes with checkbox

1 Answer 87 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
vairam
Top achievements
Rank 1
vairam asked on 18 Jan 2010, 02:46 PM
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



1 Answer, 1 is accepted

Sort by
0
Accepted
Schlurk
Top achievements
Rank 2
answered on 28 Jan 2010, 11:32 AM
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!
Tags
TreeView
Asked by
vairam
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or