我是新的 dynatree 用法。除了将每个分支的最后一个孩子显示为 null 之外,一切都很酷且延迟加载。
$("#tree").dynatree({
title: "Lazy loading sample",
fx: { height: "toggle", duration: 200 },
autoFocus: false,
initAjax: {
url: "/get_top_level_nodes",
data: { mode: "funnyMode" }
},
onActivate: function(node) {
$("#echoActive").text("" + node + " (" + node.getKeyPath()+ ")");
},
onLazyRead: function(node){
node.appendAjax({
url: "/get_children",
data: { key: node.data.key,mode: "funnyMode"}
});
}
});
如果 json 结果不为空,如下所示。它工作正常。杰森:[ { "title": "Node1", "isLazy": true, "key": "BC13B21636CD6D5C"}, { "title": "Node1", "isLazy": true, "key": "BC13B21636CD6D5C"}]
如果 ajax 结果为空[]
,我将返回为null
. null
然而我在那个分支中看到了一个子节点。我怎样才能删除这个?如果没有孩子,我不想展示null
或任何东西。