DHTMLX Docs & Samples Explorer

Grid linked to menu

Excell "context" allows to set menu as editor for grid's cell. Just try to edit column with authors.

Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">   
<link rel="stylesheet" type="text/css" href="../../../dhtmlxMenu/codebase/skins/dhtmlxmenu_dhx_skyblue.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../../dhtmlxMenu/codebase/dhtmlxmenu.js"></script>
<script  src="../../codebase/dhtmlxgrid.js"></script>
<script  src="../../codebase/dhtmlxgridcell.js"></script>    
<script  src="../../codebase/excells/dhtmlxgrid_excell_context.js"></script>
 
 
 
<table width="600px">
    <tr>
        <td>
            <div id="gridbox" style="width:100%;height:270px;background-color:white;"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="context" ></div>
        </td>
    </tr>
</table>
 
 
<script>
window.onload = function() {
    menu = new dhtmlXMenuObject();
    menu.setIconsPath("../common/images/");
    menu.renderAsContextMenu();
    mygrid = new dhtmlXGridObject('gridbox');
    mygrid.setImagePath("../../codebase/imgs/");
    mygrid.setHeader("Sales,Book Title,Author,Price,In Store,Shipping,Bestseller,Date of Publication");
    mygrid.setInitWidths("50,150,100,80,80,80,80,200");
    mygrid.setColAlign("right,left,left,right,center,left,center,center");
    mygrid.setColTypes("dyn,ed,context,price,ch,co,ra,ro");
    mygrid.setSubContext(menu, 2, 0);
    mygrid.init();
    mygrid.setSkin("dhx_skyblue");
    menu.loadXML("../common/_context.xml", function() {
        mygrid.loadXML("../common/grid.xml");
    });
}
</script>