# Menu Item type

Using the prism.on('beforemenu', function(ev, args) { ... }) event allows you to manipulate the items displayed in the menu being opened, via the args.settings.items property, which is an array of menu items.

# Properties

These are the properties that may be defined in a Menu Item:

Name Type Description
id string A unique id for the item, used to identify it in subsequent events
type string Specify a type for special menu items: "separator", "check", "header"; For regular items, type is not required
caption string The text shown on the menu item
desc string The menu item's tooltip
disabled boolean Set to true to disable the item
items MenuItem[] An array of items to create a sub-menu
execute function A function to execute when the menu item is clicked
checked boolean For checkbox type (check) items can be used to set or determine the checkbox state
classes string A string of CSS class names, separated with a space (), applied to the menu item

# Examples

# Simple action

The default state of a menu item is clickable, to perform some action.

    id: "setDefaults",
    caption: "Set as My Default Filters",
    desc: "Set as My Default Filters",
    execute: function () {
        console.log('menu item was clicked!');

An item can contain its own array of menu items. When the user hovers or clicks this item, a sub-menu of the child items is shown.

    id: "download",
    caption: "Download",
    desc: "Download",
    items: [
        { ... },
        { ... }

# Line separator

A line separator is not clickable and is only used to visually separate menu item for different categories of actions.

    type: "separator"

A header is an inactive item used only to display a text, such as a title for a section of menu items

    type: "header",
    caption: "Default Filters",
    desc: "Default Filters",
    classes: "mi-plain"  

# Checkbox

A menu item that functions as a checkbox control. Clicking it will change its checked state.

    id: "selector",
    type: "check",
    caption: "Widget affects dashboard filters",
    desc: "Widget affects dashboard filters",
    checked: false