ztree 异步加载 节点点击无法触发

代码:

    var setting = {
        async: {
            enable: true,
            url: "BDSys_List.ashx?&action=userTree",
            asyncParam: ["id", "pId", "name"],    //异步调用时传到后台的参数
            otherParam: { "otherParam": "zTreeAsyncTest" },
            dataFilter: filter
        }
    };
    function filter(treeId, parentNode, childNodes) {
        for (var i = 0; i < childNodes.Rows.length; i++) {
            childNodes.Rows[0]['open'] = true;
            childNodes.Rows[i]['id'] = i;
            childNodes.Rows[i]['pId'] = 0;
            childNodes.Rows[i]['name'] = childNodes.Rows[i]['DeviceID'];
        }
        return childNodes.Rows;
    }
$(function () {
        $.fn.zTree.init($("#userTree"), setting);
    });

 

首次的时候就加载了列表 在点击节点的时候 就没有提交请求了 我在服务器打了断点 只有第一次进来了   请问大侠 问题在那呢?

慕妹3242003
浏览 1638回答 2
2回答

拉风的咖菲猫

缺少回调事件  callback: { beforeExpand: function (treeId, treeNode) {   zTree.setting.async.url = "BDSys_List.ashx?&action=userTree";   if (treeNode.isParent) {     zTree.expandNode(treeNode);     return false;   } } }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java