Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sugandhi on Oct 07, 2008 10:27
open dhtmlx forum
Displaying SubMenu

CAN I ADD A DIV ELEMENT AS A SUBMENU? ITS NOT WORKING FOR ME. PLS SEE THE CODE

<html>
<head>
    <title>Building Menu with script</title>
    <link rel="STYLESHEET" type="text/css" href="dhtmlxmenu.css">
    <script language="JavaScript" src="dhtmlxprotobar.js"></script>
    <script language="JavaScript" src="dhtmlxmenubar.js"></script>
    <script language="JavaScript" src="dhtmlxcommon.js"></script>

        <script>
        function showmenu(state) {
            
            aMenuBar=new dhtmlXMenuBarObject(document.getElementById('menu_zone'),10,10,"");
            aMenuBar.setMenuMode("popup");
            aMenuBar.enableWindowOpenMode(false);

            //create menu item
            var item = new dhtmlXMenuItemObject("MainSpan","Span Actions","");
            aMenuBar.addItem(aMenuBar,item);

            //create submenu
            var subMenu = new dhtmlXMenuBarPanelObject(aMenuBar,item,false,10,true);        

//CAN I ADD A DIV ELEMENT AS A SUBMENU? ITS NOT WORKING FOR ME.

            //add item to submenu
            var popupSpanSubMenu = document.getElementById('popupSpanSubMenu').innerHTML;
            var item = new dhtmlXMenuItemObject(popupSpanSubMenu,"",100);
            aMenuBar.addItem(subMenu,item);
                    
            //create menu item
            var item = new dhtmlXMenuItemObject("MainNote","Notifications","");
            aMenuBar.addItem(aMenuBar,item);
    
         //create submenu
            var subMenu = new dhtmlXMenuBarPanelObject(aMenuBar,item,false,10,true);                
            
            var item = new dhtmlXMenuItemObject("note1","Notifications 1","");        
            aMenuBar.addItem(subMenu,item);                        
            var item = new dhtmlXMenuItemObject("note2","Notifications 2","");
            aMenuBar.addItem(subMenu,item);                
            

            //create menu item
            var item = new dhtmlXMenuItemObject("MainCustom","Custom Actions","");
            aMenuBar.addItem(aMenuBar,item);
            //create submenu
            var subMenu = new dhtmlXMenuBarPanelObject(aMenuBar,item,false,10,true);                
            
            var item = new dhtmlXMenuItemObject("custom1","Custom Actions 1","");        
            aMenuBar.addItem(subMenu,item);                        
            var item = new dhtmlXMenuItemObject("custom2","Custom Actions 2","");        
            aMenuBar.addItem(subMenu,item);        
            var item = new dhtmlXMenuItemObject("custom3","Custom Actions 3","");        
            aMenuBar.addItem(subMenu,item);        

            aMenuBar.showBar();
        }

    </script>
</head>

<body>
<link rel='STYLESHEET' type='text/css' href='style.css'>

<br><br>    

<input type="button" onclick="javascript:showmenu(true);" value ="DISPLAY MENU" name="toolbarbutton">

<div id="menu_zone"></div>

<br><br>

<div id="popupSpanSubMenu" style="position:absolute; top:0px; left:0px;
visibility:hidden; z-index:999">
<div id="noBorder">
<table width="100%">
<tr>
<td><b>Span Actions 1</b></td>
</tr>
<tr>
<td>
<hr color="#a6a6a6">
</td>
</tr>
<tr>
<td><b>Span Actions 2</b></td>
</tr>
</table>
</div>
</div>


</body>
</html>

Answer posted by Support on Oct 08, 2008 03:52
You can't add existing HTML element as submenu, the submenu panels can be created only through API ( or as part of configuration XML ) and will contain only menu items ( it not possible to place custom HTML there ) 
http://dhtmlx.com/docs/products/dhtmlxMenu/samples/initialization_loading/menu_building_script.html?un=1223464351000