Hi,
Been working on doing this for 3 days now. Decided it might be time to give up and ask for some help
I am looking primarily at this example here :
dhtmlx.com/docs/products/dht … _menu.html
And as I am not using XML to load the menu I am also looking at this example here :
docs.dhtmlx.com/doku.php?id=dhtm … ta_loading
It plain doesn’t work. If I follow the example (to the letter) I get page load errors, namely
A pop up alert “Incorrect cell type ‘context’”
A debugger window telling me ‘Error: Object doesn’t support property or method ‘setSubContext’’
I of course have knocked up a little test page to show what I am working with so hopefully someone can tell my where I am messing up.
<!DOCTYPE html> <!-- HTML 5 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="/css/styles.css" media="screen" />
<title>DHTMLXGridTest</title>
<link rel="STYLESHEET" type="text/css" href="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgrid.css">
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script src="/dhtmlxGrid/dhtmlxMenu/codebase/dhtmlxmenu.js"></script>
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script src="dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script src="/dhtmlxGrid/dhtmlxMenu/codebase/ext/dhtmlxmenu_ext.js"></script>
<script src="/dhtmlxGrid/dhtmlxMenu/codebase/excells/dhtmlxgrid_excell_context.js"></script>
</head>
<body>
<div id="menuData" style="display: none;">
<div id="m1" text="File"> // the first top menu item
<div id="m11" text="New"><hotkey>Ctrl+N</hotkey></div>// the first child item
<div id="ms1" type="separator"></div> // a separator
<div id="m12" text="Open"><hotkey>Ctrl+O</hotkey></div> // the second child item
</div>
</div>
<div id="mygrid_container" style="width:500px; height:270px; background-color:white;"></div>
<script>
data = {
rows:[
{ id:1,
data:[
"Model1",
"100",
"399"] }
]
}
menu = new dhtmlXMenuObject();
//menu.setIconsPath("../common/images/");
menu.renderAsContextMenu();
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("dhtmlxGrid/dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("Model,Qty,Price");
mygrid.setInitWidths("*,150,150");
mygrid.setColAlign("left,right,right");
mygrid.setColTypes("context,ed,ed");
mygrid.setSubContext(menuData, 0, 0);
mygrid.setSkin("light");
mygrid.init();
menu.loadFromHTML("menuData", true, function() {
grid.parse(data,"json");
});
//mygrid.parse(data,"json");
</script>
</body>
</html>