How to show enableHeaderMenu on button click

I have a button in a menu that will allow users to select which fields appear in the grid.
The enableHeaderMenu functionality works perfectly, but how to I show the menu with javascript instead of right clicking the grid’s header.


Unfortunately such feature is not available.

DHTML team - By any chance do we have any work around for this?
I would like to have the same feature and tried the below code, but no success.

function _c_enableHeaderMenu(gridname,arg0){
var oGrid = getGridObject(gridname);
if (null != oGrid){
oGrid.enableHeaderMenu(arg0); // arg0 can be empty or values with comma separated to either show/hide the column names in the header menu.

I just tried an alternative way … it works for me


function _c_enableHeaderMenu(grid,event){
var oGrid = getGridObject(grid); // Custom code to get the grid object based on gridname.
if (null != oGrid){
oGrid._doHContClick(event);// call dhtmlxgrid_hmenu.js internal method instead of enableHeaderMenu() api method and pass window event.