Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Saurabh Malviya on Jun 24, 2009 06:42
open dhtmlx forum
Event Handler for Context Menu for Grid Header

Hi,
http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=10029&a=16252

This solution will give me handler for right as well as left click.
I specifically want handler for only right click as its for normal context menu.
Your knowledge base provided me with mygrid.hdr.oncontextmenu but as said on above link
its not working.

What's the problem if I use
mygrid.hdr.oncontextmenu = function(e){

}
I want to use this handler only because I have cracked how to get column Id for particular header
using this event handler.
And other problem with "onHeaderClick" is that its called even on left click which is not helpful in my case
In v 1.6 same kind of handler is available, how can v2.1 restrict the user from what was provided in v1.6
Provide the solution asap.

Thanks
Answer posted by dhxSupport on Jun 24, 2009 07:42
Try to add following construction to your code:
dhtmlxEvent(mygrid.hdr,"mousedown",function(e){
  var button = (e||event).button;
  if (button == 2)
  alert(button);
  })