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

ztree jquery 树 控件

时间:2016-07-24 19:27:39      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

插件地址:http://www.ztree.me

数据:[{"id":1,"pId":-1,"name":"根目录"},{"id":2,"pId":1,"name":"子目录1"}]

<ul id="tree" class="ztree" style="padding: 0px 0px;"></ul>

 

$.ajax({
        method: ‘get‘,
        url: ‘api/ZTree/Get‘,
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            
            $.fn.zTree.init($("#tree"), {
                view: {
                    showIcon: true,
                    showLine: true,
                    showTitle: true
                },
                data: {
                    simpleData: {
                        enable: true,
                        idKey: "id",
                        pIdKey: "pId",
                        rootPId:-1
                    },
                    key: { 
                        title: "Info"
                    }
                },

                callback: {
                    onClick: function (event,treeId,treeNode,clickFlag) {
                        console.log(treeNode)
                    }
                }
            }, eval(data));
        }
    });

ztree jquery 树 控件

标签:

原文地址:http://www.cnblogs.com/CodingArt/p/5701284.html

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