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
81
82
83
84
85
| <%@ page contentType="text/html;charset=UTF-8" language="java" %>
| <!DOCTYPE html>
| <html>
| <head>
| <title></title>
| <!-- 引入bootstrap -->
| <link rel="stylesheet" type="text/css" href="static/css/bootstrap.css">
| <!-- 引入JQuery bootstrap.js-->
| <script type="text/javascript" src="static/js/jquery-3.1.1.min.js"></script>
| <script type="text/javascript" src="static/js/bootstrap.js"></script>
| <link href="static/js/plugins/treeview/bootstrap-treeview.css" rel="stylesheet" type="text/css">
| <script type="text/javascript" src="static/js/plugins/treeview/bootstrap-treeview.js"></script>
| <script type="text/javascript">
| $(function(){
| var defaultData = [
| {
| text: 'Parent 1',
| href: '#parent1',
| tags: ['4'],
| nodes: [
| {
| text: 'Child 1',
| href: '#child1',
| tags: ['2'],
| state:{
| checked:true
| },
| nodes: [
| {
| text: 'Grandchild 1',
| href: '#grandchild1',
| tags: ['0']
| },
| {
| text: 'Grandchild 2',
| href: '#grandchild2',
| tags: ['0']
| }
| ]
| },
| {
| text: 'Child 2',
| href: '#child2',
| tags: ['0']
| }
| ]
| },
| {
| text: 'Parent 2',
| href: '#parent2',
| tags: ['0']
| },
| {
| text: 'Parent 3',
| href: '#parent3',
| tags: ['0']
| },
| {
| text: 'Parent 4',
| href: '#parent4',
| tags: ['0']
| },
| {
| text: 'Parent 5',
| href: '#parent5',
| tags: ['0']
| }
| ];
| $('#treeview1').treeview({
| data: defaultData ,
| showCheckbox: true,
| highlightSelected: true, //是否高亮选中
| //nodeIcon: 'glyphicon glyphicon-user', //节点上的图标
| nodeIcon: 'glyphicon glyphicon-globe',
| emptyIcon: '', //没有子节点的节点图标
|
| });
| })
|
| </script>
| </head>
| <body>
| <div id="treeview1"></div>
| </body>
| </html>
|
|