String / Function(treeId, treeNode)setting.async.url
概述[ 依赖 jquery.ztree.core 核心 js ]
Ajax 获取数据的 URL 地址。[setting.async.enable = true 时生效]
默认值:""
String 格式说明
设置固定的异步加载 url 字符串,请注意地址的路径,确保页面能正常加载
url 内也可以带参数,这些参数就只能是通过 get 方式提交了,并且请注意进行转码
Function 参数说明
treeIdString
对应 zTree 的 treeId,便于用户操控
treeNodeJSON
需要异步加载子节点的的父节点 JSON 数据对象
针对根进行异步加载时,treeNode = null
返回值String
返回值同 String 格式的数据
setting & function 举例
1. 设置异步获取节点的 URL 为 nodes.php
var setting = {
async: {
enable: true,
url: "nodes.php",
autoParam: ["id", "name"]
}
};
......
2. 设置异步获取节点的 URL 为 function 动态获取
function getAsyncUrl(treeId, treeNode) {
return treeNode.isParent ? "nodes1.php" : "nodes2.php";
};
var setting = {
async: {
enable: true,
url: getAsyncUrl,
autoParam: ["id", "name"]
}
};
......