【发布时间】:2019-09-19 13:30:55
【问题描述】:
我有一个来自返回数据调用的 jstree 构建节点。但是有时它会返回 null,我需要通过在 UI 上显示一些错误消息来处理这个问题。我试图对返回的数据添加检查,但它一直显示加载图标,而不是显示我想要的 div 和消息。我的代码:
$('#jstree-test').jstree({
core: {
data: function (node, cb) {
$.getJSON()
.done(function (data, status, xhr) {
if(data == null)
{
$('#Error').show();
}
else
{
globfunc.redirect(xhr);
cb.call(this, data);
}
})
.fail(function (data, status, xhr) {
if (xhr.hasOwnProperty("status")) {
globfunc.redirect(xhr);
} else {
globfunc.showModal(xhr);
}
});
}
}
})
我需要做些什么来实现这一点吗?
【问题讨论】:
标签: javascript jstree