The Context Menu is accessed by right-clicking any cell in the grid.
The context menu options will vary according to what other cells are selected.
Additionally, they can choose not to display some (or all) of the shipped Context Menu items through the
showAdaptableContextMenu property / function.
If you are using a trackpad you might not be able to access the AG Grid context menu (which AdapTable uses when AG Grid is the vendor grid); if that is the case then set
allowContextMenuWithControlKey to true in GridOptions.
Context Menu Entries
There are 3 types of menu entries that can appear in the Context Menu:
- Vendor Grid Context Menu Entries - shipped by the underlying Vendor Grid
- System Context Menu Entries - shipped by AdapTable (which you can choose to hide)
- User Context Menu Entries - provided by developers at run-time (with functions available to control where and when they appear)
The default order for displaying the 3 sections in the Context Menu is: 'vendor', 'adaptable', 'user'.
However this can easily be changed via the
contextMenuOrder property in Menu Options.
When setting this property, ensure to include all 3 values, as missing entries will be absent from the menu
System Context Menu Entries
AdapTable, by default, includes a number of entries in the Context Menu.
These entries will vary depending on which column the click occurs, which other cells (if any) are selected and in which column(s).
Each entry is associated with a different
Module (to make it easy for devs to exclude those entries they don't want to appear).
The full list of Context Menu entries available in AdapTable is:
|Menu Entry||Module||When Displayed|
|Dashboard -> Configure||Dashboard||Always|
|Dashboard -> Expand / Collapse||Dashboard||Always|
|Dashboard -> Dock / Float||Dashboard||Always|
|Dashboard -> Hide / Show||Dashboard||Always|
|Clear Alert||Alert||If any live Alerts|
|Clear Flashing Alerts||Alert||Any live Flashing Alerts|
|Apply Bulk Update||Bulk Update||Single, editable column selected|
|See Cell Summary||Cell Summary||Any cells selected|
|Export Selected Cells||Export||Any cells selected|
|Filter on Cell Value(s)||Filter||Single, editable column selected|
|Show Info -> Grid||Grid Info||Always|
|Show Info -> Column||Grid Info||Single column selected|
|Clear Selected Cells||Layout||Any cells selected|
|Grid -> Auto Size||Layout||Always|
|Grid -> Select||Layout||Always|
|Apply Smart Edit||Smart Edit||Single, editable numeric column selected|
|Show System Status||System Status||Always|
If using the Chart Plugin the following Context Menu Entries are also available:
|Menu Entry||Module||Columns Displayed|
|View as Pie Chart||Chart||All|
|View as Sparkline||Chart||Single Numeric Column selected|
|Edit Sparkline Column||Sparkline Coumn||Single Sparkline Column selected|
If using the Finance Plugin the following Context Menu Entry is also available:
|Menu Entry||Description||Columns Displayed|
|Broadcast [Instrument Name]||Sends FDC3 message wrapping the Instrument||Instrument Columns|
Hiding System Menu Entries
Developers can, at design-time, choose not to display some (or all) of the shipped Context Menu entries.
This can be done in 2 ways - both via the
showAdaptableContextMenu property in Menu Options:
Simply provide a value of false (the default is true) when setting the property.
This will hide all AdapTable Context Menu items for all columns
Custom Function Implementation
Provide a custom implementation for the function allowing you to choose for each column and menu item combination whether to show it or not.
And is used as follows:
User Context Menu Entries
Developers can add their own custom entries to the Context Menu at design-time.
Each User Context Menu is of type User Menu Item defined as follows:
|disabled||Function to evaluate whether Menu Item is enabled|
|hidden||Function to evaluate whether Menu Item is visible|
|icon||Optional icon to show in the Menu Item|
|label||The text that will appear in the Menu Item|
|onClick||Function to invoke when the Menu Item is clicked|
|subMenuItems||Array of Menu Items, enabling creation of (limitless levels of) sub menus|
onClick function property is invoked by Adaptable when the menu item is selected by the user.
It takes a Menu Context object and returns void:
It might not always make sense for a User Context Menu entry to appear (e.g. it might be applicable only to numeric columns).
For this reason, the User Menu Item includes a
hidden function enabling devs to 'hide' Context Menu entries based on the menu context.
It takes a Menu Context object and returns a boolean:
An alternative to hiding the Menu Item altogether is to disable it in certain circumstances.
Therefore, the User Menu Item also includes a
disabled function which disables Context Menu entries based on the menu context.
Again, it takes a Menu Context object and returns a boolean:
Label Property / Function
Occasionally you might want the label of the User Menu Entry to vary depending on the state of your grid or other factors.
For this reason, as well as accepting a normal string value the
label property can also accept a function.
It takes a Menu Context object and returns a string:
This example shows all 4 functions at work:
AdapTable doesn't provide any context menu items for grouped rows.
This means that, by default, you will not see a context menu when clicking on a Grouped Row
However the Menu Context object does include an
isGroupedNode property allowing you to provide context menu items to display (or avoid) in Grouped Rows.
Menu Context Object
Many of the functions regarding rendering, clicking and editing Menu Items use a Menu Context object.
This provides full information and the current column, cell and grid selection and is defined as follows:
|adaptableApi||The Adaptable Api - included as a convenience|
|adaptableColumn||Current Adaptable Column|
|gridCell||Cell that has been clicked; contains cell value|
|isGroupedNode||Whether current row node is grouped|
|isRowGroupColumn||Whether current Column is Row Group|
|isSelectedCell||Whether cell that was clicked is also currently selected|
|isSingleSelectedColumn||Whether Column that was clicked is only column with selected cells|
|primaryKeyValue||Value of Primary Key column in current row|
|rowNode||Current AG Grid row node|
|selectedCellInfo||Currently selected cells in the grid|
|selectedRowInfo||Currently selected rows in the grid|
|vendorColumn||Current Vendor Grid Column|