当前位置:   article > 正文

ZTree和datatables基本使用_datatables tree

datatables tree

ZTree

 /*******树状图*******/
 $(document).ready(function () {
   
        var t = $("#treeDemo");
        t = $.fn.zTree.init(t, setting, zNodes);
        var zTree = $.fn.zTree.getZTreeObj("tree");
    });
var setting = {
   
        async: {
   
            enable: true,
            url: '/shelves/getZTreeInfo',//数据来源
            autoParam: ['id', 'pId', 'name'],//异步加载时需要自动提交父节点属性的参数
            otherParam: {
   "companyId": ""}
        },
        view: {
   
            dblClickExpand: false,
            showLine: false,
            selectedMulti: false
        },
        data: {
   
            simpleData: {
   
                enable: true,
                idKey: "id",//标识id
                pIdKey: "pid",//父id
                rootPId: ""
            }
        },
        callback: {
   
            beforeClick: function (treeId, treeNode) {
   
                var zTree = $.fn.zTree.getZTreeObj("tree");
                if (treeNode.isParent) {
   
                    zTree.expandNode(treeNode);
                    return false;
                } else {
   
                    demoIframe.attr("src", treeNode.file + ".html");
                    return true;
                }
            }
        }
    };
    var zNodes = [];
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51

后端需要返回的json格式类型

		{
   id: 1, pId: 0, name: "121-宿迁仓", open: true},
        {
   id: 11, pId: 1, name: "A-成品区"},
        {
   id: 111, pId: 11, name: "14524"},
        {
   id: 112, pId: 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号