Left-click context menu?

the jsTree contextmenu description says: "The contextmenu plugin allows you to display the context menu when the user right-clicks on the node ( or when launched programmatically by the developer).

can someone tell me how

  • I can run the menu on the left . Mouse
  • Leave the right mouse button as is
+6
source share
3 answers

Since JSTree 3

$('#jstree_list').jstree({ ... }).on('select_node.jstree', function (e, data) { setTimeout(function() { data.instance.show_contextmenu(data.node) }, 100); }); 

Delay seems necessary, I don’t know exactly why

+5
source

You can call the context menu on elem (for example, a <li>) on $(elem).trigger('contextmenu.jstree')

+1
source

There was the same problem. Here's how you do it:

 element.jstree({ . . . }).bind("select_node.jstree", function (event, data) { setTimeout(function() {data.rslt.obj.children('a').trigger('contextmenu')}, 100); }); 

Note that the run is done in setTimeout (). It didn’t work for me.

+1
source

Source: https://habr.com/ru/post/886511/


All Articles