Collapse node from the tree.
Parameters
Name | Type | Description |
---|---|---|
node | {object} | The node as jQuery object |
cascade | {boolean} | Collapse all children |
Examples
Method Sample
<button onclick="expand()" class="gj-button-md">Expand Asia</button>
<button onclick="collapse()" class="gj-button-md">Collapse Asia</button>
<br/>
<div id="tree"></div>
<script>
var tree = $('#tree').tree({
dataSource: '/Locations/Get'
});
function expand() {
var node = tree.getNodeByText('Asia');
tree.expand(node);
}
function collapse() {
var node = tree.getNodeByText('Asia');
tree.collapse(node);
}
</script>
Cascade
<button onclick="collapse()" class="gj-button-md">Collapse North America</button>
<br/>
<div id="tree"></div>
<script>
var tree = $('#tree').tree({
dataSource: '/Locations/Get'
});
function collapse() {
var node = tree.getNodeByText('North America');
tree.collapse(node, true);
}
</script>