We can manage click and double click events like below:
events: {
"click .tree-toggler": "toggletree",
"dblclick .doubleclick" : "doubleclickFunc"
},
toggletree: function(e){
//code
},
doubleclickFunc : function(e){
//code
}
But I want to manage right click event and Long click event. How to handle them?
I don't know about the "long click" event (I didn't even know there was one and can't find some doc on it), but anyway. Backbone uses jQuery's on
method to bind your events to the DOM. That means anything that works with on
will work with Backbone.View.events
(unfortunately there are some limits to the selector you specify, but apart from that).
Try:
events: {
contextmenu: 'onRightClick'
},
onRightClick: function() {
alert('it works!');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With