-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
80 lines (68 loc) · 1.78 KB
/
index.html
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<!--===== HEAD =====-->
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="backbone-treeview.css">
<title>Backbone Treeview Widget</title>
<meta name="description" content="Backbone Treeview Widget Demo">
<meta name="author" content="Josh Bothun">
</head>
<!--===== BODY =====-->
<body>
<div class="container">
<div id="tree-view"></div>
</div>
<!--===== JS =======-->
<!-- Libs -->
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="js/underscore-min.js" type="text/javascript"></script>
<script src="js/backbone-min.js" type="text/javascript"></script>
<!-- Treeview -->
<script src="backbone-treeview.js"></script>
<script>
// Create a collection of nodes and populate with sample data
var collection = new TreeNodeCollection([
{
id: 0,
title: 'Root',
children: [1, 2, 3],
},
{
id: 1,
title: 'Node 1',
children: [],
},
{
id: 2,
title: 'Node 2',
children: [4, 5],
},
{
id: 3,
title: 'Node 3',
children: [],
},
{
id: 4,
title: 'Node 4',
children: [],
},
{
id: 5,
title: 'Node 5',
children: [],
},
]);
// Instantiate a TreeView on the root
var treeView = new TreeView({
el: $('#tree-view'),
model: collection.get(0),
});
// Render view
treeView.render();
</script>
</body>
</html>