如何将自定义行为附加到jsTree的双击中? [英] How can I attach custom behaviour to a double click in jsTree?
本文介绍了如何将自定义行为附加到jsTree的双击中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jsTree jQuery插件,并希望在用户双击节点时执行代码.
I'm using the jsTree jQuery plugin and want to execute code when the user double clicks a node.
我似乎无法正常工作.我在ondblclk
事件上找到了一些文档,但没有触发.
I can't seem to get it to work. I found some documentation on a ondblclk
event but it doesn't fire.
browser.jstree(
{
plugins: ["themes", "json_data", "ui", "cookies"],
callback:
{
ondblclk: function (node, tree) {
if (!thisReportBrowserthis._isFoldersOnly) {
var f = node;
}
}
}
}
);
如何使用 jstree 处理双击事件?
How can I handle double click events with jstree?
推荐答案
事实证明我可以做到:
jstree.bind("dblclick.jstree", function (event) {
var node = $(event.target).closest("li");
var data = node.data("jstree");
// Do my action
});
node
包含被单击的li
,data
包含其中包含我的信息的元数据.
node
contains the li
that was clicked and data
contains the metadata with my info in it.
这篇关于如何将自定义行为附加到jsTree的双击中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文