removeItem (value, isDispose);
value. The main menu button, an instance of the MainMenuButton class, that must be removed.
isDispose. Determines whether the main menu button must be fully deleted. By default it is set to true.
The removeItem method removes a child item of the main menu
To execute the example, the HTML page must contain MainMenu component named mainMenu (seep; Example of creating the MainMenu component). Add the input box to the field in which the name of the menu item, that is to be removed, is set and the button that removes the item with the selected name from the menu:
<input type="text" id="remCont" />
<input type="button" id="remBut" value="Remove item" onclick="RemoveItem();" />
The following javascript code must be added to the separator:
function RemoveItem() {
var remCont = document.getElementById("remCont");
var val = remCont.value;
for (var i = 0; i < mainMenu._Items.length; i++)
var item = mainMenu._Items[i];
if (val === item.getContent())
mainMenu.removeItem(item);
}
The main menu item which name is set in the input box is removed from the menu by clicking the Remove Item button after an example execution. Only the right-most buttons of the main menu are available to be deleted in the example:
The picture above shows the removal of the right-most item with the Format name of the main menu by clicking the button.
See also: