JavaScript Data Grid Menu
- Description
- Methods
- close
- closeAllSubMenus
- closeSubMenu
- destroy
- executeCommand
- getSelectedItem
- hasSelectedItem
- isAllSubMenusClosed
- isCommandPassive
- isOpened
- isSubMenu
- onAfterSelection
- open
- openSubMenu
- selectFirstCell
- selectLastCell
- selectNextCell
- selectPrevCell
- setHorizontalPositionForLtr
- setHorizontalPositionForRtl
- setMenuItems
- setOffset
- setPosition
- setPositionAboveCursor
- setPositionBelowCursor
- setPositionOnLeftOfCursor
- setPositionOnRightOfCursor
Description
Methods
close
Source code (opens new window)menu.close([closeParent])
Close menu.
Param | Type | Default | Description |
---|---|---|---|
[closeParent] | boolean | false | optional If true try to close parent menu if exists. |
closeAllSubMenus
Source code (opens new window)menu.closeAllSubMenus()
Close all opened sub menus.
closeSubMenu
Source code (opens new window)menu.closeSubMenu(row)
Close sub menu at row index.
Param | Type | Description |
---|---|---|
row | number | Row index. |
destroy
Source code (opens new window)menu.destroy()
Destroy instance.
executeCommand
Source code (opens new window)menu.executeCommand([event])
Execute menu command.
The executeCommand()
method works only for selected cells.
When no cells are selected, executeCommand()
doesn't do anything.
Param | Type | Description |
---|---|---|
[event] | Event | optional The mouse event object. |
getSelectedItem
Source code (opens new window)menu.getSelectedItem() ⇒ object | null
Returns currently selected menu item. Returns null
if no item was selected.
hasSelectedItem
Source code (opens new window)menu.hasSelectedItem() ⇒ boolean
Checks if the menu has selected (highlighted) any item from the menu list.
isAllSubMenusClosed
Source code (opens new window)menu.isAllSubMenusClosed() ⇒ boolean
Checks if all created and opened sub menus are closed.
isCommandPassive
Source code (opens new window)menu.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.
Param | Type | Description |
---|---|---|
commandDescriptor | object | Selected menu item from the menu data source. |
isOpened
Source code (opens new window)menu.isOpened() ⇒ boolean
Checks if menu was opened.
Returns: boolean
- Returns true
if menu was opened.
isSubMenu
Source code (opens new window)menu.isSubMenu() ⇒ boolean
Check if menu is using as sub-menu.
onAfterSelection
Source code (opens new window)menu.onAfterSelection(r, c, r2, c2, preventScrolling)
On after selection listener.
Param | 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
Source code (opens new window)menu.open()
Open menu.
Emits: Hooks#event:beforeContextMenuShow
, Hooks#event:afterContextMenuShow
openSubMenu
Source code (opens new window)menu.openSubMenu(row) ⇒ Menu | boolean
Open sub menu at the provided row index.
Param | Type | Description |
---|---|---|
row | number | Row index. |
Returns: Menu
| boolean
- Returns created menu or false
if no one menu was created.
selectFirstCell
Source code (opens new window)menu.selectFirstCell()
Select first cell in opened menu.
selectLastCell
Source code (opens new window)menu.selectLastCell()
Select last cell in opened menu.
selectNextCell
Source code (opens new window)menu.selectNextCell(row, col)
Select next cell in opened menu.
Param | Type | Description |
---|---|---|
row | number | Row index. |
col | number | Column index. |
selectPrevCell
Source code (opens new window)menu.selectPrevCell(row, col)
Select previous cell in opened menu.
Param | Type | Description |
---|---|---|
row | number | Row index. |
col | number | Column index. |
setHorizontalPositionForLtr
Source code (opens new window)menu.setHorizontalPositionForLtr(cursor)
Set menu horizontal position for LTR mode.
Param | Type | Description |
---|---|---|
cursor | Cursor | Cursor object. |
setHorizontalPositionForRtl
Source code (opens new window)menu.setHorizontalPositionForRtl(cursor)
Set menu horizontal position for RTL mode.
Param | Type | Description |
---|---|---|
cursor | Cursor | Cursor object. |
setMenuItems
Source code (opens new window)menu.setMenuItems(menuItems)
Set array of objects which defines menu items.
Param | Type | Description |
---|---|---|
menuItems | Array | Menu items to display. |
setOffset
Source code (opens new window)menu.setOffset(area, offset)
Set offset menu position for specified area (above
, below
, left
or right
).
Param | Type | Default | Description |
---|---|---|---|
area | string | Specified area name (above , below , left or right ). | |
offset | number | 0 | Offset value. |
setPosition
Source code (opens new window)menu.setPosition(coords)
Set menu position based on dom event or based on literal object.
Param | Type | Description |
---|---|---|
coords | Event object | Event or literal Object with coordinates. |
setPositionAboveCursor
Source code (opens new window)menu.setPositionAboveCursor(cursor)
Set menu position above cursor object.
Param | Type | Description |
---|---|---|
cursor | Cursor | Cursor object. |
setPositionBelowCursor
Source code (opens new window)menu.setPositionBelowCursor(cursor)
Set menu position below cursor object.
Param | Type | Description |
---|---|---|
cursor | Cursor | Cursor object. |
setPositionOnLeftOfCursor
Source code (opens new window)menu.setPositionOnLeftOfCursor(cursor)
Set menu position on the left of cursor object.
Param | Type | Description |
---|---|---|
cursor | Cursor | Cursor object. |
setPositionOnRightOfCursor
Source code (opens new window)menu.setPositionOnRightOfCursor(cursor)
Set menu position on the right of cursor object.
Param | Type | Description |
---|---|---|
cursor | Cursor | Cursor object. |