z-tree 回显所有选中的id

//回显选择的checkbox函数
function treeHxIdFun(obj) {
    var objTree = $.fn.zTree.init($("#demo"), setting, nodes);
    var zTreeObj = $.fn.zTree.getZTreeObj("demo");
    var zTree = objTree.getCheckedNodes(false);
    for(var i = 0; i < obj.length; i++){
        zTreeObj.checkNode(zTreeObj.getNodeByParam("id", obj[i]));
        zTreeObj.selectNode(zTreeObj.getNodeByParam("id", obj[i]));
    };
};

obj =["34", "3", "34#add"] 数组,id 与树形的所有id 一致

posted @ 2018-08-10 10:18 abcByme 阅读(...) 评论(...) 编辑 收藏