Context Menu

View as Markdown

Summary

  • AdapTable extends AG Grid's cell context menu — AG Grid owns the menu; AdapTable adds module items via contextMenuOptions.customContextMenu
  • The Context Menu provided by AG Grid (when you right-click in a Cell) is extended by AdapTable
  • As a result 3 sets of Menu Items can appear in the Context Menu:
    • Provided by AG Grid
    • Shipped by AdapTable
    • Supplied by Developers
  • Developers have full control over the content and order of these sections

The AG Grid Context Menu is accessed by right-clicking any cell in the Grid.

Caution

The Menu only displays if the MenuModule (or AllEnterpriseModules) is provided to AG Grid

Topics in this Section

TopicSummary
This pageAG Grid + AdapTable items, selection-dependent entries
Context Menu Default StructureDefault sections, export tree, item names
Configuring the Context MenuReorder, restructure, remove with customContextMenu
Custom Context Menu ItemsUserContextMenuItem and framework menu rows
Context Menu Technical ReferencecontextMenuOptions, context types, contextMenuApi
Column MenuSame callback pattern for header menus

AdapTable Menu Items

AdapTable provides a large number of useful Menu Items — see Context Menu Default Structure.

These are appended to AG Grid's own Context Menu.

Note

The Menu Items displayed will vary depending on the cell clicked and which other cells are selected

Each Menu Item contains 2 properties which allow developers to reference it, enabling full control over each Menu Item's visibility and position:

AG Grid Menu Items

AdapTable makes 2 changes to the default context menu items which are provided by AG Grid:

  • it groups the Copy / Paste related items into a "Copy and Paste" menu item (with 5 sub menu items)
  • it hides the Export Menu Item (as this is provided in a fuller form by AdapTable's export menu items)

Hint

AdapTable also allows developers to change AG Grid's menu items (this can also be done directly in AG Grid)

Configuring the Context Menu

The Context Menu can be configured at design-time to meet users' requirements.

This is done via the customContextMenu property in Context Menu Options, which can be used to arrange the Context Menu in multiple ways:

  • reorder Menu Items
  • restructure Menu Items
  • remove Menu Items
  • add Custom Menu Items

Find Out More

See Configuring the Context Menu and Adding Custom Context Menu Items for full details of these topics

FAQ

How does AdapTable relate to AG Grid here? AG Grid renders the context menu. AdapTable prepends/appends module items and lets you reshape the combined menu in customContextMenu. Context exposes the same structured and flat defaults as the column menu (defaultAdaptableMenuStructure, defaultAgGridMenuStructure, and flat *MenuItems variants).

How is the Context Menu different from the Column Menu? Context items depend on cell selection and include sections such as Export and Bulk Update / Smart Edit that do not appear in the column menu. Default layouts are documented separately — compare the two default structure pages.

How do I hide or reorder AdapTable items? Implement customContextMenu and filter by name using Context Menu Default Structure.

Can I add my own menu entries? Yes — return UserContextMenuItem entries from the callback, or see Custom Context Menu Items.

I replaced AdapTable items but lost AG Grid Notes — what happened? If your callback returns only AdapTable items, include AG Grid's note entry from defaultAgGridMenuStructure when Notes are enabled (requires AG Grid Notes support).

I cannot access the AG Grid Context Menu on my laptop? If you are using a trackpad and are unable to access the AG Grid context menu, set allowContextMenuWithControlKey to true in GridOptions.

Can I remove AG Grid menu items? Yes - via AG Grid or AdapTable depending whether you want to remove some or all of AG Grid's Menu Items:

  • to remove some AG Grid menu items (e.g. Copy) use the GetContextMenuItems property in AG Grid Grid Options
  • to remove all the AG Grid menu items use the customContextMenu property in Context Menu Options

Can I hide some Menu Options that I do not require? Yes, the customContextMenu property in Context Menu Options allows you to define which AdapTable Context Menu Items should be displayed

Why do I not see all the menu options listed on the default structure page? There are 2 possibilities:

  • check you are not using customContextMenu property in Context Menu Options to hide some menu items
  • check which Entitlements are currently applied — AdapTable does not show menu items for Hidden entitlements