码迷,mamicode.com
首页 > Web开发 > 详细

jQuery的zTree插件(待补充)

时间:2019-10-09 17:30:46      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:lse   cti   lis   simple   contex   query   head   api   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插件(待补充)

标签:lse   cti   lis   simple   contex   query   head   api   ztree插件   

原文地址:https://www.cnblogs.com/yadongliang/p/11642931.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!