Show / hide items
Select Item |
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Show / hide 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(itemId){
if (myMenu.getItemType(itemId) != "separator") sel.options.add(new Option(myMenu.getItemText(itemId), itemId));
});
}
});
}
function getId() {
return sel.options[sel.selectedIndex].value;
}
function show() {
myMenu.showItem(getId());
}
function hide() {
myMenu.hideItem(getId());
}
function isHidden() {
alert(myMenu.isItemHidden(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"> </td>
<td><select id="sel"></select></td>
<td width="10"> </td>
<td><input type="button" value="Show" onclick="show();"> <input type="button" value="Hide" onclick="hide();"> <input type="button" value="Is Hidden?" onclick="isHidden();"></td>
</tr>
</table>
</div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.