Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

context menu on left mouse click?

the description of jsTree contextmenu says "The contextmenu plugin enables a contextual menu to be shown, when the user right-clicks a node (or when triggered programatically by the developer)."

could somebody tell me how

  • I can trigger the menu on left mouse click
  • leave the right mouse as it is
like image 221
Radek Avatar asked Apr 23 '11 00:04

Radek


People also ask

How do I get to the context menu in Windows 10?

Left-click brings up Context Menu Open Windows 10 Device Settings and click on Mouse and Touchpad . Scroll down a bit and click on Additional Mouse Options .

Is it possible to add a context menu on left click?

Although it is possible, it would be against standard windows expectations to display a context menu on left click. Regarding making this MVVM, I believe the XAML would be in your "view", the Image_MouseDown C# code would be in your "view model", and your "model" should not know anything about the context menu. Here is a XAML only solution.

How to display right-click context menu on the right side?

This tutorial shows you 2 simple ways to make Windows 10 display right-click context menu on the right side instead of the left side. Press the Windows key + R to open the Run box. Type the following command and press Enter.

How do I move the context menu to the left side?

If you want Windows to show context menu to the left side, just set MenuDropAlignment back to 1. After you edit the value, you need to sign out and sign in back to your Windows account or restart your computer. Windows should place the context menu on the right side.


2 Answers

Since JSTree 3

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

The delay seems necessary, I don't know exactly why

like image 50
Pierre de LESPINAY Avatar answered Oct 13 '22 02:10

Pierre de LESPINAY


You can trigger context menu on elem (eg. a <li>) by $(elem).trigger('contextmenu.jstree')

like image 1
Taha Jahangir Avatar answered Oct 13 '22 03:10

Taha Jahangir