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 The mouse event object.
-
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 containsisCommand
property set tofalse
, 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)
-
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. -
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
orright
).Parameters:
Name Type Default Description area
string Specified area name (
above
,below
,left
orright
).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.