You may also want to read the documentation on types (and also read about the type attribute).
01.
$(
function
() {
02.
$(
"#demo_1"
).tree({
03.
rules : {
04.
// only nodes of type root can be top level nodes
05.
valid_children : [
"root"
]
06.
},
07.
types : {
08.
// all node types inherit the "default" node type
09.
"default"
: {
10.
deletable :
false
,
11.
renameable :
false
12.
},
13.
"root"
: {
14.
draggable :
false
,
15.
valid_children : [
"folder"
],
16.
icon : {
17.
image :
"drive.png"
18.
}
19.
},
20.
"folder"
: {
21.
valid_children : [
"file"
],
22.
max_children : 3
23.
},
24.
"file"
: {
25.
// the following three rules basically do the same
26.
valid_children :
"none"
,
27.
max_children : 0,
28.
max_depth :0,
29.
icon : {
30.
image :
"file.png"
31.
}
32.
}
33.
}
34.
});
35.
});