DHTMLX Docs & Samples Explorer

Iterator


Source
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxmenu_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxmenu.js"></script>
<script src="../../codebase/ext/dhtmlxmenu_ext.js"></script>
 
<div style="height: 250px;"><div id="menuObj"></div></div>
<input type="button" value="Disable All Nested" onclick="disable();">
<input type="button" value="Enable All Nested" onclick="enable();">
 
<br>
<script>
var menu;
function initMenu() {
    menu = new dhtmlXMenuObject("menuObj");
    menu.setIconsPath("../common/imgs/");
    menu.loadXML("../common/dhxmenu.xml?etc=" + new Date().getTime());
}
function disable() {
    menu.forEachItem(function(id) {
        if (menu.getItemType(id) != "separator" && menu._getItemLevelType(id) != "TopLevel")
            menu.setItemDisabled(id);
    });
}
function enable() {
    menu.forEachItem(function(id) {
        if (menu.getItemType(id) != "separator" && menu._getItemLevelType(id) != "TopLevel")
            menu.setItemEnabled(id);
    });
}
</script>