Home > Java > javaTutorial > body text

Use of zTree tree plug-in--Introduction to asynchronous loading method

零下一度
Release: 2017-06-26 14:45:43
Original
1981 people have browsed it
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>异步加载</title>
<link rel="stylesheet"href="${pageContext.request.contextPath}/zTree_v3-master/css/demo.css?1.1.11">
<link rel="stylesheet"href="${pageContext.request.contextPath}/zTree_v3-master/css/zTreeStyle/zTreeStyle.css?1.1.11">
<script type="text/javascript"src="${pageContext.request.contextPath}/jquery-2.1.1.min.js?1.1.11"></script>
<script type="text/javascript"src="${pageContext.request.contextPath}/zTree_v3-master/js/jquery.ztree.core.min.js?1.1.11"></script>
<script type="text/javascript">var setting = {
        async : {
            enable : true,
            url : "${pageContext.request.contextPath}/ztreeAction!getMenusById.jhtml",
            autoParam : [ "id" ],//dataFilter : filter        },
        data : {
            key : {
                url : "xUrl"},
            simpleData : {
                enable : true,
                pIdKey : "pid"}
        },

    };
    $(document).ready(function() {
        $.fn.zTree.init($("#treeDemo"), setting);
    });</script>



</head>
<body>
    <div class="ztree"style="width: 20%; height: 500px; padding-top: 10px; float: left; border: 1px solid #FF0000;">
        <ul id="treeDemo"></ul>
    </div>

</body>
</html>
Copy after login

The above is the code of the jsp page. Because it is a pure plug-in test, you can directly copy the code used in the past.

action层代码,可以直接复制使用
Copy after login
    public void getMenusById(){
        List<Ztree> list=null;try {
            list=ztreeService.getMenusById(ztree);
        } catch (Exception e) {
            e.printStackTrace();
        }super.writeJson(list);
    }
Copy after login
 List<Ztree> getMenusById(Ztree ztree)  Exception;
//接口
Copy after login
"ztreeService"  ZtreeServiceImpl  List queryList(Ztree ztree) =" from Ztree where 1=1 "<String, Object> params =  HashMap<String, Object>(ztree.getId()!=+=" and id = :id ""id" List<Ztree> getMenusById(Ztree ztree) =" from Ztree where 1=1 "<String,Object> params= HashMap<String,Object>(ztree.getId()==||ztree.getId().equals(""+=" and pid is null "+= " and pid = :id ""id"<Ztree> queryZtree =<Ztree> list= ArrayList<Ztree>"true"  queryBoolean(Ztree ztree)  flag== " from Ztree where pid = :id "<String,Object> params= HashMap<String,Object>"id"<Ztree> queryZtree =(queryZtree!=&&queryZtree.size()>0=
Copy after login

There is no need to write the dao layer, it is just a query. I will attach the ztree table fields below

I hope it can help everyone. This is the test code when I learn the ztree plug-in again, the annotated version of the ssh framework. I haven’t tried it in other frameworks, but after understanding how to use it, it should be fine. , I believe you are all much better than me. Not a master, just sharing. God, don’t squirt~~~~~~~~~~

The above is the detailed content of Use of zTree tree plug-in--Introduction to asynchronous loading method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!