ztree的使用
//导入资源文件
<script type="text/javascript" src="/wcm.files/js/jquery-plugin/ztree/3.5/js/jquery.ztree.all.min.js"></script>
<link rel="stylesheet" href="/wcm.files/js/jquery-plugin/ztree/3.5/css/zTreeStyle/zTreeStyle.css" type="text/css">、
//初始化
var setting = {
view : {
selectedMulti : false
},
async : {
enable : true,
url : "${ctx}/sys/infomanage/article/getJsonByPid",
autoParam : [ "id"],
otherParam : {"otherParam" : "zTreeAsyncTest"},
dataFilter : filter
},
data : {
key : {
//前面的name为树上面的名字,后面的数据为json中的字段
name : "text",
title : "name"
},
keep : {
parent : true
}
/*
,
simpleData: {
enable: true, //为true时可以用简单的jsion格式来写
idKey: "id",
pIdKey: "pId",
rootPId: 0
}
*/
},
callback : {
onExpand:onExpandVoid,
onCollapse:onCollapseVoid,
beforeExpand : beforeExpand,//beforeClick : zTreeBeforeClick,
//onExpand : onExpand,
//beforeClick: beforeClick,
//beforeAsync: beforeAsync,
//onAsyncError: onAsyncError,
onClick : loadTree,
onAsyncSuccess : onAsyncSuccess
}
};
$(document).ready(function() {
var zNodes=//后台的json数据
$.fn.zTree.init($("#tree"), setting, zNodes);
});
<body>
<ul id="tree" class="zTree"></ul>
</body>
3150

被折叠的 条评论
为什么被折叠?



