Created
May 1, 2014 18:59
-
-
Save lanceon/72742d98151c0140851e to your computer and use it in GitHub Desktop.
jqTree - collapse/expand tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $tree = $('#tree1'); | |
$('#collapse').click(function() { | |
var tree = $tree.tree('getTree'); | |
tree.iterate(function(node) { | |
if (node.hasChildren()) { | |
$tree.tree('closeNode', node, true); | |
} | |
return true; | |
}); | |
}); | |
$('#expand').click(function() { | |
var tree = $tree.tree('getTree'); | |
tree.iterate(function(node) { | |
if (node.hasChildren()) { | |
$tree.tree('openNode', node, true); | |
} | |
return true; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment