ztree 异步加载 节点点击事件无触发 只有第一次刷新的时候才加载! 50
代码:varsetting={async:{enable:true,url:"BDSys_List.ashx?&action=userTree",asyncParam:[...
代码:
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;
}
var zTree, HoldID;
$(function () {
seadMsg_add.attr("disabled", true);
$("#layout").ligerLayout({ leftWidth: 180, topHeight: '95%', width: '95%', space: 2 });
$.fn.zTree.init($("#userTree"), setting); 展开
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;
}
var zTree, HoldID;
$(function () {
seadMsg_add.attr("disabled", true);
$("#layout").ligerLayout({ leftWidth: 180, topHeight: '95%', width: '95%', space: 2 });
$.fn.zTree.init($("#userTree"), setting); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询