nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jqTree / _entries / 16_data.md
1 ---
2 title: data
3 name: options-data
4 ---
5
6 Define the contents of the tree. The data is a nested array of objects. This option is required.
7
8 It looks like this:
9
10 {% highlight js %}
11 var data = [
12     {
13         name: 'node1',
14         children: [
15             { name: 'child1' },
16             { name: 'child2' }
17         ]
18     },
19     {
20         name: 'node2',
21         children: [
22             { name: 'child3' }
23         ]
24     }
25 ];
26 $('#tree1').tree({data: data});
27 {% endhighlight %}
28
29 * **name**: name of a node (required)
30     * Note that you can also use `label` instead of `name`
31 * **children**: array of child nodes (optional)
32 * **id**: int or string (optional)
33     * Must be an int or a string
34     * Must be unique in the tree
35     * The `id` property is required if you use the multiple selection feature
36
37 You can also include other data in the objects. You can later access this data.
38
39 For example, to add an id:
40
41 {% highlight js %}
42 {
43     name: 'node1',
44     id: 1
45 }
46 {% endhighlight %}