javascript - 花式树:如何根据结果调用两个端点
问题描述
我在我的应用程序 UI 中使用花哨的树:
f_tree = $("#nodes_tree").fancytree({
extensions: ["table"],
table: {
indentation: 24,
nodeColumnIdx: 0
},
source: [
{
title: "/",
key: "jcr:root",
folder: true,
lazy: true,
}
],
lazyLoad: function (event, data) {
let node = data.node;
let path = buildPath(node);
if (path !== '/') {
data.result = {
url: 'http://localHost:8080/getDetails'
};
} else {
data.result = elasticResponse;
}
},
postProcess: function (event, data) {
if (data.response) {
data.result = data.response._paths;
}
},
renderColumns: function (event, data) {
let d = data.node.data,
$tdList = $(data.node.tr).find(">td");
if (d.attributes) {
//console.info(`step 333`);
$tdList.eq(1).text(d.attributes['title'])
}
}
});
我无法编写条件,如果“http://localHost:8080/getDetails/1234”将返回 {} 空白 json 响应而不是 {"_paths":[{"title":"..."}]" } 响应然后它应该调用另一个 url 即;“http://localHost:8087/getAnotherDetails/1234”。请让我知道如何在花哨的树中实现这一点。
解决方案
推荐阅读
- sql - 如何在 AWS Athena 中的最后一个分隔符之前获取部分字符串
- c# - Textlocal 没有向我的手机号码发送短信
- include - include vs. load in mit-scheme
- xamarin - Xamarin.Forms - Android 全球不支持 PushAsync,请使用 NavigationPage
- python - 合并(从右侧加入)目录中的所有文件
- puppet - Puppet - 如果源不可用,则静默退出
- linux - 如果我在尝试访问 Samba 共享时收到“转换错误:非法多字节序列”,这意味着什么?
- java - Spring Data Jpa 一些 List 数据查询 find id 做 70000time 然后发生 com.mysql.cj.exceptions.CJCommunicationsException
- json - AWS API Gateway 响应映射模板不起作用
- android - 显示尺寸最大时 parentWidth 返回错误值?