Enable / disable items

Select Item    
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Enable / disable items</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		var myMenu;
		var sel;
		function doOnLoad() {
			sel = document.getElementById("sel");
			myMenu = new dhtmlXMenuObject({
				parent: "menuObj",
				icons_path: "../common/imgs/",
				xml: "../common/dhxmenu.xml",
				onload: function() {
					myMenu.forEachItem(function(id){
						if (myMenu.getItemType(id) != "separator") {
							sel.options.add(new Option(myMenu.getItemText(id),id));
						}
					});
				}
			});
		}
		function getId() {
			var id = sel.options[sel.selectedIndex].value;
			return id;
		}
		function enable() {
			myMenu.setItemEnabled(getId());
		}
		function disable() {
			myMenu.setItemDisabled(getId());
		}
		function isEnabled() {
			alert(myMenu.isItemEnabled(getId()));
		}
	</script>
</head>
<body onload="doOnLoad()">
	<div style="height: 250px;"><div id="menuObj"></div></div>
	<div>
		<table border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>Select Item</td>
				<td width="10">&nbsp;</td>
				<td><select id="sel"></select></td>
				<td width="10">&nbsp;</td>
				<td><input type="button" value="Enable" onclick="enable()"> <input type="button" value="Disable" onclick="disable()"> <input type="button" value="Is Enabled?" onclick="isEnabled()"></td>
			</tr>
		</table>
	</div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.