The easiest way is to use ivhTreeviewBfs
to collect selected nodes.
var selectedNodes = []
ivhTreeviewBfs(myTree, function(node) {
if(node.selected) {
selectedNodes.push(node)
}
})
Note that you can use ivhTreeviewOptions
to get the appropriate "selected" attribute if you want to be fully generic. Also, folks will often want to only collect the top-most selected node for a given tree branch. In this case you can return false
in the callback passed to ivhTreeviewBfs
and that node's children will not be visited.
You can read more about the bfs service here.