Hi, can anybody see/explain what I'm doing wrong here? Or let me know a better way to do this. I've tried several approaches, not just the one shown here, but all approaches turn up the same problem.
I have a tree with several levels. I want to remove some nodes from a given level, but leave others: i.e. selectively remove nodes based on their values, all client-side javascript. If I do this:
var t = $find(ClientID_RadTree1);
var p = t.findNodeByValue(""); // gets parent node
for (var i=0; i<p.get_nodes().get_count();i++)
{
var node = p.get_nodes().getNode(i);
console.log(node.get_text());
if (node.get_value() != '1') p.get_nodes().remove(node); // only leave the node with value='1'
}
I have to run in THREE times to get the intended results. Apparently, the node indexes are being changed upon each "remove" call, or something similar.
Any tips (or source code for the TreeView Javascript)?
Thanks!
R
I have a tree with several levels. I want to remove some nodes from a given level, but leave others: i.e. selectively remove nodes based on their values, all client-side javascript. If I do this:
var t = $find(ClientID_RadTree1);
var p = t.findNodeByValue(""); // gets parent node
for (var i=0; i<p.get_nodes().get_count();i++)
{
var node = p.get_nodes().getNode(i);
console.log(node.get_text());
if (node.get_value() != '1') p.get_nodes().remove(node); // only leave the node with value='1'
}
I have to run in THREE times to get the intended results. Apparently, the node indexes are being changed upon each "remove" call, or something similar.
Any tips (or source code for the TreeView Javascript)?
Thanks!
R