<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%
String contextPath = request.getContextPath();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<link href="<%=contextPath%>/resources/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script src="<%=contextPath%>/resources/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="<%=contextPath%>/resources/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="<%=contextPath%>/resources/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script> <!-- CSS样式 -->
<style type="text/css">
.box{
float: left;
}
.tree{
width: 230px;
height: 200px;
margin: 10px;
border: 1px solid #ccc;
overflow: auto;
}
h4{ margin: 10px;
}
</style>
</head>
<body>
<ul id="tree"></ul>
</body>
<script type="text/javascript">
var treeData = [
{ 'name': '节点1', 'no':1 ,
'children':
[
{ 'name': '节点1.1','no':1 },
{ 'name': '节点1.2','no':2 },
{ 'name': '节点1.3',
'children': [
{ 'name': '节点1.3.1' },
{ 'name': '节点1.3.2' }
]
},
{ 'name': '节点1.4' }
]
},
{ 'name': '节点2' }
];
$(function(){
$("#tree").ligerTree({
checkbox: true,
parentIcon: null,
childIcon: null ,
slide: true, //是否显示动画
nodeWidth: 100,
idFieldName: 'id',
textFieldName:'name' , //指定数据中要显示的属性名,默认为"text"
data: treeData
});
});
//var tree = $("#tree").ligerGetTreeManager();
//tree.setData(treeData) ; //或者这样设值
</script> </html>
效果如下: