Open ,menu as contextmenu in dhtmlxgrid and left click on me

We use dhtmlxgrid and have a contextmenu (dhtmlxmenu) associated with the dhtmlxgrid (via enableContextMenu). We also want the same menu to open from a menu button positioned above the upper left corner of the dhtmlxgrid. Currently we use a second dhtmlxmenu object configured with setOpenMode(“win”) which has only an icon but not text associated. Questions:

1) The menu div dhtmlxMenu_dhx_blue_TopLevel_Item_Normal has a padding-left: 27pt hard coded on the generated text, so it is not easily possible to have just the menu icons without a text. As a workaround we used some style “hacking”, but were are not completely satisfied with the solution:

div.dhtmlxMenu_dhx_blue_TopLevel_Item_Normal {

    margin-left: -27px;

div.dhtmlxMenu_dhx_blue_TopLevel_Item_Selected {

    margin-left: -27px;


div.dhtmlxMenu_dhx_blue_SubLevelArea_Polygon_left {

    position: absolute;

    background-color: white;

    border-top: #C2D5DC 1px solid;

    overflow: hidden;


2) Because we now have to menu objects, also both can be opened. One with the left lick on the menu icon, one with the right click on the dhtmlxgrid and the user can end up with two menu objects opened simulaneously.

Ideally we only want to have one menu object which we can set as the contextmenu of the dhthmlxgrid, so it opens on right click and also associated it to our menu icon.

Is there any possibilty to do that? Do you have a suggestion how to prevent both menus to open at the same time? Could the styles be simpllified (remove the hard coded styles)?

Could you please provide completed demo?

Completed demo information here: