Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp improve this Javascript code?
    primarykey
    data
    text
    <p><strong>EDIT2:</strong> <br /> I omitted the line that updates the UI "urrentNode.set_checked(checked);", and it run amazingly fast. Apparently this is the reason of that performance bottleneck, what do you guys suggest? <br /></p> <p>Hello SO, <br /></p> <p>In short, I'm dealing with Telerik's RadTreeView, and I want enable checking all the child nodes if the user checked the parent node. Simple enough! OK here's my code that handles OnClientNodeChecked event of the TreeView: <br /></p> <pre><code>function UpdateAllChildren(nodes, checked) { var i; for (i = 0; i &lt; nodes.get_count(); i++) { var currentNode = nodes.getNode(i); currentNode.set_checked(checked); if (currentNode.get_nodes().get_count() &gt; 0) { UpdateAllChildren(currentNode.get_nodes(), checked); } } } function ClientNodeChecked(sender, eventArgs) { var node = eventArgs.get_node(); UpdateAllChildren(node.get_nodes(), node.get_checked()); } </code></pre> <p>And here's the TreeView's markup: <br /></p> <pre><code>&lt;telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="True" OnClientNodeChecked="ClientNodeChecked"&gt;&lt;/telerik:RadTreeView&gt; </code></pre> <p>The tree contains quite a lot of nodes, and this is causing my targeted browser (ehm, that's IE7) to really slow down while running it. Furthermore IE7 displays an error message asking me to stop the page from running scripts as it's might make my computer not responsive (yeah, scary enough). So what do you guys propose to optimize this code? <br /> <strong>EDIT:</strong> Runs pretty fast in firefox and chrome of course. Needles to say, hah? <br /></p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload