Hi,
I have implemented the webtree view funcationality on the client side. I have done following things
Adding of parents and its childs and its working fine. but the problem is while adding new nodes, previous nodes are not clearing . I did not find clear nodes method in Client Side Api.
Can you let me know how to clear the nodes on client . i want clear the all the nodes from the client side.
Thanks in advance
Hi anilkoomar_1202,
Thank you for posting in the community.
Removing individual nodes client-side can be achieved using the remove() function. For instance the first child of the first root can be done using:
ig_controls.WebDataTree1.getNode(0).get_childNode(0).remove()
You can "clear" all items from the tree by removind all root nodes. This can be achieved using something similar to:
function removeAll() { while (ig_controls.WebDataTree1.getNodes().get_length() > 0) { ig_controls.WebDataTree1.getNodes().getNode(0).remove(); } }
Please let me know if this helps.
Thanks for your reply,
I have got the solution
function ClearNodes() {
currentTree = $find('<%= WebDataTree1.ClientID %>');
var tree = currentTree;
var nodes = tree.getNodes();
var len = nodes.get_length();
// Loop Thru Root Items
for (var i = len - 1; i > 0; i--) {
var node = nodes.getNode(i);
tree.remove(node, false); //dispose()
}