Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Glen on Jul 16, 2007 11:21
open dhtmlx forum
nested context menu

Hi, I need help in creating a nested context menu without using loadXml.

<menu absolutePosition="auto" mode="popup" maxItems="8" globalCss="contextMenu" globalSecondCss="contextMenu" globalTextCss="contextMenuItem">
        <MenuItem name="Red" src="red.gif" id="edit_Red"/>    
        <MenuItem name="Green" src="green.gif" id="edit_Green"/>    
        <MenuItem name="Blue" src="blue.gif" id="edit_Blue"/>    
        <MenuItem name="Other..." src="" id="outher" width="120px" panelWidth="120">
            <MenuItem name="Yellow" src="yellow.gif" id="edit_Yellow"/>    
            <MenuItem name="White" src="white.gif" id="edit_White"/>    
        </MenuItem>
</menu>

The online example for the the contxt menu is below :
http://www.java2s.com/Code/JavaScriptDemo/Contextmenupopupmenu.htm


So the question is I wish to replicate the above nested example ("Other.." menu) for my context menu. I know you can do loadXml().
But I'm more insterested in doing it using javascript call like below:

var contextMenu= new dhtmlXContextMenuObject('155',0, "images/scbr_icons/");
contextMenu.menu.addItem(contextMenu.menu, new dhtmlXMenuItemObject('icon21.gif','Red...',20,18,0,'new_Id','New tooltip'))
contextMenu.menu.addItem(contextMenu.menu, new dhtmlXMenuItemObject('icon21.gif','Green...',20,18,0,'new_Id','New tooltip'))
contextMenu.menu.addItem(contextMenu.menu, new dhtmlXMenuItemObject('icon21.gif','Blue...',20,18,0,'new_Id','New tooltip'))
contextMenu.menu.addItem(contextMenu.menu, new dhtmlXMenuItemObject('icon21.gif','Other...',20,18,0,'new_Id','New tooltip'))

... How do I add the sub menu for "Other.." ??


Can you help me.

Thanks



Answer posted on Jul 19, 2007 10:24
Building context menu with script was described here: http://www.scbr.com/docs/products/dhtmlxMenu/samples/menuEx20.html
Answer posted by Nadine (Support) on Dec 02, 2014 20:03

The information connected with xml grid and grid control c also can help you, so please check it too.