Menu

Methods

close(closeParent)

Close menu.

Parameters:
Name Type Default Description
closeParent Boolean false optional

if true try to close parent menu if exists.

closeAllSubMenus()

Close all opened sub menus.

closeSubMenu(row)

Close sub menu at row index.

Parameters:
Name Type Description
row Number

Row index.

destroy()

Destroy instance.

executeCommand(event)

Execute menu command.

Parameters:
Name Type Description
event Event optional

getSelectedItem(){Object|null}

Returns currently selected menu item. Returns null if no item was selected.

Returns: {Object|null}

hasSelectedItem(){Boolean}

Checks if the menu has selected (highlighted) any item from the menu list.

Returns: {Boolean}

isAllSubMenusClosed(){Boolean}

Checks if all created and opened sub menus are closed.

Returns: {Boolean}

isCommandPassive(commandDescriptor){Boolean}

Checks if the passed command is passive or not. The command is passive when it's marked as
disabled, the descriptor object contains isCommand property set to false, command
is a separator, or the item is recognized as submenu. For passive items the menu is not
closed automatically after the user trigger the command through the UI.

Parameters:
Name Type Description
commandDescriptor Object

Selected menu item from the menu data source.

Returns: {Boolean}

isOpened(){Boolean}

Checks if menu was opened.

Returns: {Boolean} Returns true if menu was opened.

isSubMenu(){Boolean}

Check if menu is using as sub-menu.

Returns: {Boolean}

onAfterSelection(r, c, r2, c2, preventScrolling, selectionLayerLevel)

On after selection listener.

Parameters:
Name Type Description
r Number

Selection start row index.

c Number

Selection start column index.

r2 Number

Selection end row index.

c2 Number

Selection end column index.

preventScrolling Object

Object with value property where its value change will be observed.

selectionLayerLevel Number

The number which indicates what selection layer is currently modified.

open()

Open menu.

Fires:

openSubMenu(row){Menu|Boolean}

Open sub menu at the provided row index.

Parameters:
Name Type Description
row Number

Row index.

Returns: {Menu|Boolean} Returns created menu or false if no one menu was created.

selectFirstCell()

Select first cell in opened menu.

selectLastCell()

Select last cell in opened menu.

selectNextCell(row, col)

Select next cell in opened menu.

Parameters:
Name Type Description
row Number

Row index.

col Number

Column index.

selectPrevCell(row, col)

Select previous cell in opened menu.

Parameters:
Name Type Description
row Number

Row index.

col Number

Column index.

setMenuItems(menuItems)

Set array of objects which defines menu items.

Parameters:
Name Type Description
menuItems Array

Menu items to display.

setOffset(area, offset)

Set offset menu position for specified area (above, below, left or right).

Parameters:
Name Type Default Description
area String

Specified area name (above, below, left or right).

offset Number 0

Offset value.

setPosition(coords)

Set menu position based on dom event or based on literal object.

Parameters:
Name Type Description
coords Event | Object

Event or literal Object with coordinates.

setPositionAboveCursor(cursor)

Set menu position above cursor object.

Parameters:
Name Type Description
cursor Cursor

Cursor object.

setPositionBelowCursor(cursor)

Set menu position below cursor object.

Parameters:
Name Type Description
cursor Cursor

Cursor object.

setPositionOnLeftOfCursor(cursor)

Set menu position on the left of cursor object.

Parameters:
Name Type Description
cursor Cursor

Cursor object.

setPositionOnRightOfCursor(cursor)

Set menu position on the right of cursor object.

Parameters:
Name Type Description
cursor Cursor

Cursor object.

Class: Menu