Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Saurabh Malviya on Jun 16, 2009 09:41
open dhtmlx forum
Header Menu Even Handler

Hi,
I needed an event handler for grid header context menu and after checking out
knowledge base I used
mygrid.hdr.oncontextmenu = function(e){
mymenu.showItem('addRow');
mymenu.showItem('deleteRow');
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.

Thanks
Answer posted by dhxSupport on Jun 17, 2009 01:54
As you can see on this post http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=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){});