How can I attach custom behaviour to a double click in jsTree?

前端 未结 6 699
南方客
南方客 2020-12-31 01:18

I\'m using the jsTree jQuery plugin and want to execute code when the user double clicks a node.

I can\'t seem to get it to work. I found some documentation on a

6条回答
  •  死守一世寂寞
    2020-12-31 01:52

    The above answers do not work on the latest version of jstree (which is 3.3.4)
    This cost me a day of mind bending work but I finally got it. Here is working doubleclick to Edit code:

    $('#tree1').bind("dblclick.jstree", function (event) {
      var tree = $(this).jstree();
      var node = tree.get_node(event.target);
      tree.edit(node);
    });

    and here is a working jsfiddle.

提交回复
热议问题