On the server side api, each DataTreeNode has the methods ExpandChildren and CollapseChildren. Is there equivalent functionality in the client-side api? I see that a node has as toggle() method. Will I need to simply iterate through them calling this toggle each time?
Thanks,
Rob Quick
Rob,
It is correct that there is no corresponding function on the client to accomplish that. You will have to iterate through the descendants and expand each one. However, calling toggle() would be incorrect. This switches the expanded status of a node. So if a child of the node whose children you are expanding is already expanded, it will then be collapsed. You'll want to call .set_expanded(true). I have written a small recursive function that will expand or collapse the children of the given node.
function expandChildren(node, expanded) { node.set_expanded(expanded, true, true); var child = node.get_childNode(0); while (child != null) { expandChildren(child, expanded); child = child.get_nextNode(); } }
regards,Dave Young
Thanks for the clarification. Appreciate the quick response.