[ 登录注册 ]

yuyan

zTree-基本树

2016-08-25 22:33:53 admin 返回上一页

1、实现源码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>zTree-基本树</title>
		<link rel="stylesheet" href="css/demo.css" />
		<link rel="stylesheet" href="css/zTreeStyle/zTreeStyle.css" />
		<script type="text/javascript" src="js/jquery-1.4.4.min.js" ></script>
		<script type="text/javascript" src="js/jquery.ztree.core.js" ></script>
		<script>
			$(function(){
				$.fn.zTree.init($("#tree"), setting, zNodes);
			});
			
			var setting = {
			view: {
				showIcon: showIconForTree
			},
			data: {
				simpleData: {
					enable: true
				}
			}
		};

		var zNodes =[
			{ id:1, pId:0, name:"计算机编程语言", open:true},
			{ id:11, pId:1, name:"Java"},
			{ id:12, pId:1, name:"C#"},
			{ id:13, pId:1, name:"C++"},
			{ id:2, pId:0, name:"数据库", open:true},
			{ id:21, pId:2, name:"Oracle"},
			{ id:22, pId:2, name:"SQL Server"},
			{ id:23, pId:2, name:"MySQL"}
		];

		function showIconForTree(treeId, treeNode) {
			return !treeNode.isParent;
		};
		</script>
	</head>
	<body>
		<div>
			<ul id="tree" class="ztree"></ul>
		</div>
	</body>
</html>

2、实现结果



文章来源:http://www.bozhiyue.com/web/yuyan/2016/0825/433314.html
返回上一页    返回分类 上一篇:   下一篇:
相关