gpt4 book ai didi

jstree移动,拖放

转载 作者:行者123 更新时间:2023-12-03 23:01:10 24 4
gpt4 key购买 nike

我想为 jstree 中的节点实现移动功能。是需要执行的移动还是拖放?此外,拥有将容器绑定(bind)到事件和事件代码的工作代码会很好。

最佳答案

$("#demo1").jstree({
....
.bind("move_node.jstree", function (e, data) {

/*
requires crrm plugin

.o - the node being moved
.r - the reference node in the move
.ot - the origin tree instance
.rt - the reference tree instance
.p - the position to move to (may be a string - "last", "first", etc)
.cp - the calculated position to move to (always a number)
.np - the new parent
.oc - the original node (if there was a copy)
.cy - boolen indicating if the move was a copy
.cr - same as np, but if a root node is created this is -1
.op - the former parent
.or - the node that was previously in the position of the moved node */

var nodeType = $(data.rslt.o).attr("rel");
var parentType = $(data.rslt.np).attr("rel");

if (nodeType && parentType) {
// TODO!
}
})
});

关于jstree移动,拖放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10486770/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com