Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Poornima on Apr 07, 2009 03:10
open dhtmlx forum
Disable Context Menu for grid Header

Hi,

How do I disable a context menu only for the grid header ? I tried using,
grdEvent.enableHeaderMenu();
grdEvent._doHContClick =function(){
grid.enableContextMenu(null);
return false;
}

But it throws an error "that._showHContext is not a function" , I have included the dhtmlxgrid_hmenu.js but it doesnt help.


Answer posted by dhxSupport on Apr 07, 2009 05:28

Grid's context menu will work only for the rows. If you want disable browser's context menu: 

mygrid.hdr.oncontextmenu=function(){return false};

Note that in Opera it's impossible to block native context menu. 

Answer posted on Apr 07, 2009 05:44

Is there any particular js file to be included for the above to work as required ? I tried using the above solution but it does not work.

When I right click on the grid header the context menu is appearing, but the context menu should be appearing only in case of right click on the grid rows and not on the header.

 

Answer posted by dhxSupport on Apr 07, 2009 07:12

Please check if you are calling this method after grid was fully loaded:

mygrid.loadXML("grid.xml",function(){

mygrid.hdr.oncontextmenu=function(){return false};

});