jQuery的zTree插件(待补充)
Posted yadongliang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery的zTree插件(待补充)相关的知识,希望对你有一定的参考价值。
写在前面
jQuery的 zTree插件
关键代码
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@include file="/context/mytags.jsp" %> <!DOCTYPE html > <html> <head> <title>菜单列表</title> <t:base type="jquery"></t:base> <link rel="stylesheet" type="text/css" href="plug-in/ztree/css/metroStyle.css"> <script type="text/javascript" src="plug-in/ztree/js/jquery.ztree.core-3.5.min.js"></script> <script type="text/javascript" src="plug-in/ztree/js/jquery.ztree.excheck-3.5.min.js"></script> <script type="text/javascript"> var setting = { check: { enable: false,// 是否启用复选框 chkboxType: {"Y": "", "N": ""} }, data: { simpleData: { enable: true } }, callback: { onExpand: zTreeOnExpand } }; //加载展开方法 function zTreeOnExpand(event, treeId, treeNode) { var treeNodeFuncId = treeNode.id; $.post( ‘whiteListController.do?getMenuInfo‘, {parentFuncId: treeNodeFuncId}, function (data) { var d = $.parseJSON(data); if (d.success) { var dbDate = eval(d.msg); var tree = $.fn.zTree.getZTreeObj("menuSelect"); if (!treeNode.zAsync) { tree.addNodes(treeNode, dbDate); treeNode.zAsync = true; } else { tree.reAsyncChildNodes(treeNode, "refresh"); } } } ); } //首次进入加载level为1的 $(function () { $.post( ‘whiteListController.do?getMenuInfo‘, function (data) { var d = $.parseJSON(data); if (d.success) { var dbDate = eval(d.msg); $.fn.zTree.init($("#menuSelect"), setting, dbDate); } } ); }); </script> </head> <body style="overflow-y: auto" scroll="no"> <ul id="menuSelect" class="ztree" style="margin-top: 30px;"></ul> </body> </html>
感谢
以上是关于jQuery的zTree插件(待补充)的主要内容,如果未能解决你的问题,请参考以下文章
zTree —— JQuery Tree 插件 | 软件推介
JQuery树形插件zTree+iFrame实现个性网址簿工具
jQuery插件--zTree中点击节点实现页面跳转时弹出两个页面的问题