引入js/css样式

<link rel="stylesheet" type="text/css" href="<%=path%>/easyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/easyUI/themes/icon.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/easyUI/css/demo.css">
<script src="<%=path%>/js/jquery-1.8.3.js"></script>
<!--jquery.easyui.min.js包含了easyUI中的所有插件-->
<script src="<%=path%>/js/jquery.easyui.min.js"></script>

编写script

<script>
$(function(){
$('#tree').tree({
url:'basic_tree_data.json', //远程加载tree数据的url路径
animate:true, //是否开启动画效果
checkbox:true, //是否显示复选框
cascadeCheck:false, //是否开启级联选中,checkbox属性为true时才生效
onlyLeafCheck:true, //是否只在叶节点前显示复选框,checkbox属性为true时才生效
dnd:true, //是否启用拖拽功能
onDblClick:function(node){ //鼠标双击事件
$(this).tree("toggle",node.target); //改变当前节点状态
}
});
});
</script>

编写body

<body>
<h2>easy UI Tree</h2>
<ul id="tree"></ul>
</body>

编写basic_tree_data.json

[{
"id":1,
"text":"功能菜单",
"children":[{
"id":11,
"text":"投票管理",
"children":[{
"id":111,
"text":"所有投票",
"attributes":{
"url":"findAll"
},
"iconCls":"icon-search"
},{
"id":112,
"text":"发起投票",
"iconCls":"icon-add"
}]
},
{
"id":12,
"text":"用户管理",
"state":"open",
"children":[{
"id":121,
"text":"个人信息"
},{
"id":122,
"text":"参与投票记录",
"iconCls":"icon-search"
},{
"id":123,
"text":"发起投票记录",
"iconCls":"icon-search"
}]
},{
"id":13,
"text":"系统管理",
"state":"open",
"children":[{
"id":131,
"text":"系统日志"
},{
"id":132,
"text":"数据字典"
}]
}]
}]

实现效果

最新文章

  1. 中软培训第一周复习总结 --简单的HTML 与CSS
  2. usb驱动开发14之设备生命线
  3. Openvswitch原理与代码分析(6):用户态流表flow table的操作
  4. MFC实现Gif动画制作工具
  5. js调用百度地图API创建地图,搜索位置
  6. Java日期处理类
  7. Code Snippet Library
  8. LWIP裸机环境下实现TCP与UDP通讯
  9. 常见的html面试题
  10. 设计模式的征途—3.抽象工厂(Abstract Factory)模式
  11. jmeter压测数据库,抓包工具,python基础
  12. IDEA配置github并上传项目
  13. Redis 保护模式
  14. 一、Sql Server 基础培训《进度1-建库建数据表(实际操作)》
  15. 如何相互转换逗号分隔的字符串和List【转】
  16. Examples of GoF Design Patterns in Java&#39;s core libraries
  17. [转载]Oracle左连接、右连接、全外连接以及(+)号用法
  18. centos7-jdk快速安装
  19. BZOJ2322 [BeiJing2011]梦想封印 【set + 线性基】
  20. Android调用Webservice发送文件

热门文章

  1. [SQL] SQL 基础知识梳理(三) - 聚合和排序
  2. spring aop
  3. React.js深入学习详细解析
  4. 读书笔记--SQL必知必会15--插入数据
  5. Android面试一天一题(1Day)
  6. reStructuredText(rst)快速入门语法说明
  7. 使用Adminlite + ASP.NET MVC5(C#) + Entityframework + AutoFac + AutoMapper写了个api接口文档管理系统
  8. 设计模式(九)装饰者模式(Decorator Pattern)
  9. Xcode7.1环境下上架iOS App到AppStore 流程① (Part 一)
  10. spring/spring boot/spring cloud开发总结