0

Im trying to catch the oncontextmenu and onmousedown events of a control that is a kendoUI combobox.

I've created (modified existing) a Jsfiddle that shows an example of what we are trying to achieve.

Jsfiddle

document.getElementById("cbo1").oncontextmenu = function(ev){
    alert(ev);    
    return false;
};

document.getElementById("cbo1").onmousedown = function(ev){
    alert(ev);            
};

You can see that the mouse down and the context menu items are not firing for the comboBox input but they are firing fine for the standard input.

Any ideas on how i can get the mouse events firing for the combobox input?

Matt
  • 3,305
  • 11
  • 54
  • 98

2 Answers2

0

This question is similar to this, except you want a click and oncontext event for kendo combobox which is a non registered event and that is not posible using jquery alone since kendo UI doesn't expose it to jQuery refer to this kendo forum post.

To summary the answer, you can to this by modifying the answer form above question, dont forget move your return false otherwise the right click options will appear.

$(element.input).bind("contextmenu", function (e) {
                binding.get();
                return false
});

refer to this jsfiddle

Community
  • 1
  • 1
himawan_r
  • 1,760
  • 1
  • 14
  • 22
0

This is how I did it...

var $parent = $(element.input).closest('.k-combobox')
$parent.on({ 'mouseenter': function(){  }, 'mouseleave': function(){  } });

Works just fine.

EXPLANATION:
You can't put the event (directly) onto the Element.Input or onto the control (itself). But you're using jQuery...so you can find the control-container & put the event on that...and voila!

For those that need visuals..

Prisoner ZERO
  • 13,848
  • 21
  • 92
  • 137