DHTMLX Docs & Samples Explorer

Attach Grid

Source
<meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../../../dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_skyblue.css"/>
    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxpopup_dhx_skyblue.css"/>
    <link rel="stylesheet" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
    <link rel="stylesheet" type="text/css" href="../../../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
    
    <script src="../../codebase/dhtmlxcommon.js"></script>
    <script src="../../../dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
    <script src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
    <script src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
    <script src="../../codebase/dhtmlxpopup.js"></script>
    
    <style>
        #myToolbar {
            margin: 10px;
        }
    </style>
    <script>
 
var myToolbar;
var myPop;
var myGrid;
var eId;
 
function doOnLoad() {
 
    myToolbar = new dhtmlXToolbarObject("myToolbar", "dhx_skyblue");
    myToolbar.setIconsPath("../common/imgs/");
    myToolbar.loadXML("../common/toolbar.xml?etc=" + new Date().getTime(), function() {
 
        myToolbar.setItemText("workbut", "Grid");
 
        myPop = new dhtmlXPopup({
            toolbar: myToolbar,
            id: "workbut"
        });
        eId = myPop.attachEvent("onShow", function() {
            // grid cosmetic fix
            myGrid.setSizes();
            myGrid.setSizes();
            myPop.detachEvent(eId);
        });
 
        myGrid = myPop.attachGrid(350, 300);
        myGrid.setImagePath("../../../dhtmlxGrid/codebase/imgs/")
            myGrid.loadXML("../common/grid.xml?etc=" + new Date().getTime());
 
        myGrid.attachEvent("onRowDblClicked", function() {
            myPop.hide();
        });
 
    });
 
}
</script> <style> </style> <div id="myToolbar"></div>