Currently both left and right click select the node which interferes contextmenu as I use left clicks to go to other pages. How do I make select_node.jstree
event know which mouse button is being clicked?
Asked
Active
Viewed 7,973 times
9

웃웃웃웃웃
- 11,829
- 15
- 59
- 91

Alexander Suraphel
- 10,103
- 10
- 55
- 90
-
1This might help you. Please have a look- http://stackoverflow.com/questions/3944122/detect-left-mouse-button-press – Chirag Mongia Dec 18 '13 at 07:35
3 Answers
16
You can also Use "select_node":false in the "contextmenu" section of your jstree settings to disable activating the node with the right click

periklis
- 10,102
- 6
- 60
- 68
-
@silver @periklis I want the node to be selected on both button clicks. My question is how do I take different actions depending on which button triggered the `select_node.jstree` event. – Alexander Suraphel Apr 07 '16 at 11:37
-
@AlexanderSuraphel I'm not sure how to do this, why don't you post this as a new question? – periklis Apr 07 '16 at 11:55
-
@periklis that was the original intent of my question! But does making `"select_node":false` appear selected when right clicked? – Alexander Suraphel Apr 07 '16 at 12:32
9
Because I wanted the click event to be fired on left click I return false when the click event is fired for right click.
$("#orgTree").bind("select_node.jstree", function(event, data) {
var evt = window.event || event;
var button = evt.which || evt.button;
if( button != 1 && ( typeof button != "undefined")) return false;
...
});

Alexander Suraphel
- 10,103
- 10
- 55
- 90
-
1
-
2@JakeOS this was answered in '14 not in '10 :) but I'm glad you found it helpful! – Alexander Suraphel Jun 18 '15 at 16:04
0
There is new event (itemClick)
available since version 4.0.0 released for handling left click only !
$('#jqxWidget').bind('itemClick', function (event) {
//Other codes goes here.
}

Shree Krishna
- 8,474
- 6
- 40
- 68