z-tree用法

2017-12-30  本文已影响0人  炒面Z

setting参数设置

var setting = {
    async : {
        enable: true,
        type: "get",
        url: "../../eldercare/service/serviceCarrier/selectServiceCarrier",
        // autoParam: ["serviceCarrierId"]
    },
    data : {
        simpleData : {
            enable : true,
            idKey : "id",
            title : "supplierName",
            pIdKey : "0",
            rootPId : ""
        },
        key : {
            url : "nourl"
        }
    },
    callback : {
        onClick : function(event, treeId, treeNode) {
            vm.keyword.serviceCarrierId = treeNode.id;
            vm.load();
        }
    }
};

ztree初始化

//r为后端返回的list
var array = r;
array.splice(0,0,{ id:null,name:'全部机构'});//手动设置一个root节点
var ztree = $.fn.zTree.init($("#cjjgTree"), setting, array);
上一篇下一篇

猜你喜欢

热点阅读