jstree contextmenu 一次克隆(如复制、粘贴和重命名)
我正在开发 jstree 的上下文菜单,显然需要右键菜单中的克隆功能,该功能实际上是复制、粘贴和重命名的模拟,这样一旦用户右键单击一个项目,然后单击克隆,就会复制一个节点(复制并粘贴到树中,并以重命名突出显示为重点,以便用户可以在那里重命名它,
我尝试了下面的代码来自定义克隆菜单项,但它不起作用
cloneItem: { //“克隆”菜单项
标签:“克隆”,
动作:函数(obj)
{
this.copy(obj);
this.paste(obj);
}
。
非常感谢任何帮助
I am working on contextmenu for jstree, and apparently needed a clone functionality in right click menu which will actually be simulation of copy , paste and rename, so that once user right clicks on an item and then clicks on clone, a node is copied (copied and pasted in the tree , and focused with rename highlight so that user could rename it right there.
I tried code below for custom clone menu item, but it doesn't work
cloneItem: { // The "clone" menu item
label: "Clone",
action: function (obj)
{
this.copy(obj);
this.paste(obj);
}
}
Any help is very much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过研究,我弄清楚了如何实现这个克隆,做到这一点的关键是粘贴到复制节点的父节点上。这是代码。
执行此操作的步骤
我希望它能帮助那些需要在 jstree 中克隆的人。
After research I figured out how this clone could be implemented, the key to do this was as paste goes on parent node of copied node. here is code.
steps to do this are
I hope it will help someone, who needs clone in jstree.