PopMenuItem Class

Constructor

PopMenuItem(options)

A PopMenuItem object represents a menu item on a context menu.

Options

action: function

since 1.0

A callback to be executed when a menu item is selected. Assigning this option will override any existing 'action' callbacks. To add multiple callbacks, please use on() method instead.

disabled: boolean = false

since 1.0

Disable menu item.

href: string

since 1.0

URL to open when the item is selected.

icon: string

since 1.0

Icon common name or icon path to use. When specifying relative path, the path is relative to the directory of the HTML page.

id: string

since 1.0

ID of the menu item.

label: string

since 1.0

Label of the menu item. If not specified, the menu item will act as a separator.

submenu: PopMenu

since 1.0

An item can have a submenu. In this case, a collection of PopMenuItems or an instance of PopMenu can be assigned to this option.

target: string

since 1.0

Open the URL specified in href on the specified target window. Specify _blank to open in a new window.

type: string = "item"

since 1.0

item|separator

Specify the type of the menu.

visible: boolean = true

since 1.0

Toggle visibility.

Properties

$: jQuery

since 1.0

Reference to DOM (jQuery) representation of the menu item.

$icon: jQuery

since 1.0

Reference to DOM (jQuery) representation of the menu item's icon (PopMenu-Icon).

$link: jQuery

since 1.0

Reference to DOM (jQuery) representation of the menu item's label (PopMenu-Link).

data: Object

since 1.0

Internally stores the menu item options. Please use options() method to get/set menu item options.

callbacks: Object

since 1.0

Stores event callbacks internally. Please use on() or off() to bind or unbind callbacks instead.

submenu: PopMenu

since 1.0

Access to the submenu object.

Events

action

since 1.0

Triggered when a menu item is selected.

Methods

disable: boolean

since 1.0

disable([disabled])

Enable/disable menu item, or check current disable state.

hide: void

since 1.0

hide()

Set menu item visibility to hidden. Use show() to show.

href: string

since 1.0

href([url])

Get/set href property, a URL to open when the item is selected.

icon: string

since 1.0

icon([icon])

Get/set icon for the menu item.

label: string

since 1.0

label([label])

Get/set label for the menu item.

off: void

since 1.0

off(event)

Unbind event callbacks.

on: void

since 1.0

on(event, callback)

Bind a callback to an event.

options: object

since 1.0

options([options])

Get/set menu item options. The options set or returned from this methods are from data property, which contains options bound to the PopMenu object.

show: void

since 1.0

show()

Set menu item visibility to visible. Use hide() to hide.

updateLabel: void

since 1.0

updateLabel([force])

Update menu label. Particularly used when a function is assigned to the item label instead of string. To assign a new label, please use label() instead.

visible: boolean

since 1.0

visible([value])

Toggle visibility of the menu item, or check current disable state.