Header Menu Even Handler


I needed an event handler for grid header context menu and after checking out

knowledge base I used

mygrid.hdr.oncontextmenu = function(e){



return true;


But when I am using this event handler the context menu is not coming and

there is no error also.

Everything is implemented perfectly because as soon as I comment the handler code,

I can see the context menu on header when I right click.

Provide the solution asap.


As you can see on this post dhtmlx.com/docs/products/kb/ … =kb&q=8990 mygrid.hdr.oncontextmenu = function(e){} used to block native browser’s context menu. Unfortunately there is no event which fired after showing header contex menu which was set with mygrid.enableHeaderMenu().
If you want to catch header’s click you can use “onHeaderClick” event. This event occurs right after a header was clicked, before sorting or any other actions. onHeaderClick event passes the following parameters:
ind - index of the column;
obj - related javascript event object.
grid.attachEvent(“onHeaderClick”, function(ind,obj){});