【发布时间】:2015-07-16 13:42:23
【问题描述】:
我正在尝试使用 angularjs 限制节点下降到某些特定节点。为此,我覆盖了一些 jstree 事件,例如 move_node、dnd_move.vakata。没有任何效果。
【问题讨论】:
标签: jstree jstree-dnd
我正在尝试使用 angularjs 限制节点下降到某些特定节点。为此,我覆盖了一些 jstree 事件,例如 move_node、dnd_move.vakata。没有任何效果。
【问题讨论】:
标签: jstree jstree-dnd
您无法覆盖事件 - 只需对它们做出反应。您正在寻找的配置选项是core.check_callback。至于角度 - 这取决于您使用的包装器 - 我自己不使用角度,所以我无法帮助您 - 只要确保您使用 core.check_callback - 这是一个回调,在结构更改即将执行时执行发生:
core : {
check_callback : function (op, node, parent, position, more) {
if(more && more.dnd) {
// do checks here and return false to prevent the drop
// or return true to allow it
// depending on the node / parent / position arguments
}
return true;
},...
【讨论】: