nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jqTree / _entries / 61_updatenode.md
1 ---
2 title: updateNode
3 name: functions-updatenode
4 ---
5
6 **function updateNode(node, name);**
7
8 **function updateNode(node, data);**
9
10 Update the title of a node. You can also update the data.
11
12 Update the name:
13
14 {% highlight js %}
15 var node = $tree.tree('getNodeById', 123);
16
17 $tree.tree('updateNode', node, 'new name');
18 {% endhighlight %}
19
20 Update the data (including the name)
21
22 {% highlight js %}
23 var node = $tree.tree('getNodeById', 123);
24
25 $tree.tree(
26     'updateNode',
27     node,
28     {
29         name: 'new name',
30         id: 1,
31         other_property: 'abc'
32     }
33 );
34 {% endhighlight %}
35
36 It is also possible to update the children. Note that this removes the existing children:
37
38 {% highlight js %}
39 $tree.tree(
40     'updateNode',
41     node,
42     {
43         name: 'new name',
44         id: 1,
45         children: [
46             { name: 'child1', id: 2 }
47         ]
48     }
49 );
50 {% endhighlight %}