ContextMenu
Description
The ContextMenu (shared between all DataGridXL instances) is the menu that appears when right-clicking inside a DataGridXL Renderer.
Usage
The DataGridXL class has a static property contextMenu.
// create DataGridXL instance
const grid = new DataGridXL(...);
// work with the shared ContextMenu instance
grid.constructor.contextMenu.selectItem(2);
grid.constructor.contextMenu.events.on('open', ...);NOTE: You don't need to create a ContextMenu instance yourself — it is provided by the grid automatically.Methods
close()Close context menu
$closeisOpen(): booleanCheck if context menu is open
booleanReturns `true` if context menu is open, otherwise `false`.moveCursorDown()Move cursor down inside list of items
moveCursorUp()Move cursor up inside list of items
open(items, bounds)Open context menu
Arguments
arrayArray of context menu itemsobjectTarget bounds in pixels `{ top, right, bottom, left }`$beforeopen$openselectItem(index)Select context menu item by index
Arguments
numberIndex of context menu item$beforeselectitem$selectitemsetCursor(index)Set the cursor to the given index
Arguments
numberIndex of cursorupdateItemLabels(items)Update item labels
Arguments
arrayArray of context menu itemsEvents
closeContextMenuEventFires when context menu closes
Payload
typestringtargetContextMenubeforeopenContextMenuOpenEventFires before context menu opens You may modify `payload` to alter the behavior Returning `false` cancels the event.
Payload
typestringtargetContextMenupayloadContextMenuOpenEventPayloadopenContextMenuOpenEventFires when context menu opens
Payload
typestringtargetContextMenupayloadContextMenuOpenEventPayloadbeforeselectitemContextMenuSelectItemEventFires before a context menu item is selected You may modify `payload` to alter the behavior Returning `false` cancels the event.
Payload
typestringtargetContextMenupayloadContextMenuSelectItemEventPayloadselectitemContextMenuSelectItemEventFires when a context menu item is selected
Payload
typestringtargetContextMenupayloadContextMenuSelectItemEventPayload