Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prashant on May 07, 2009 12:56
open dhtmlx forum
ContexMenu loading from string not working

Hi,

I just need to display one item in context menu (edit) and here is my code

menu = new dhtmlXMenuObject(null, "standard");
menu.setImagePath("../../../includes/dHTMLX/codebase/imgs/");
menu.renderAsContextMenu();
menu.setOpenMode("web");
menu.attachEvent("onClick", onButtonClick);
menu.loadXML("<?xml version='1.0' ?><menu id='0'><item text='Edit' id='edit_Red'/></menu>");

I attached the context menu to treeGrid

mygrid1.enableContextMenu(menu);

but I am getting an error "Incorrect XML". I don't want to use the XML file to load contextMenu. Please suggest.
Answer posted by dhxSupport on May 08, 2009 00:51

Cotext menu in such case is a instance of dhtmlxMenu. You can use any available dhtmlxMenu API method for the variable "menu". 

To load menu from the xml string you should use method menu.loadXMLString("<?xml version='1.0' ?><menu id='0'><item text='Edit' id='edit_Red'/></menu>").

You can find more information about data loading in dhtmlxMenu here http://dhtmlx.com/docs/products/dhtmlxMenu/doc/guide.html#menu_vxak0