sisense.com

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:

NameTypeDescription
idstringA unique id for the item, used to identify it in subsequent events
typestringSpecify a type for special menu items: "separator", "check", "header"; For regular items, type is not required
captionstringThe text shown on the menu item
descstringThe menu item's tooltip
disabledbooleanSet to true to disable the item
itemsMenuItem[]An array of items to create a sub-menu
executefunctionA function to execute when the menu item is clicked
checkedbooleanFor checkbox type (check) items can be used to set or determine the checkbox state
classesstringA 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
}
Last Updated: