blob: 5c9a6c1967625cb4c5e938763c88eeabbfb20c65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
---
title: openNode
name: functions-opennode
---
**function openNode(node);**
**function openNode(node, slide);**
**function openNode(node, on_finished);**
**function openNode(node, slide, on_finished);**
Open this node. The node must have child nodes.
Parameter **slide (optional)**: open the node using a slide animation (default is true).
Parameter **on_finished (optional)**: callback when the node is opened; this also works for nodes that are loaded lazily
{% highlight js %}
// create tree
var $tree = $('#tree1');
$tree.tree({
data: data
});
var node = $tree.tree('getNodeById', 123);
$tree.tree('openNode', node);
{% endhighlight %}
To open the node without the slide animation, call with **slide** parameter is false.
{% highlight js %}
$tree.tree('openNode', node, false);
{% endhighlight %}
Example with `on_finished` callback:
{% highlight js %}
function handleOpened(node) {
console.log('openende node', node.name);
}
$tree.tree('openNode', node, handleOpened);
{% endhighlight %}
|