# Context Menu Default Structure

Canonical page: https://www.adaptabletools.com/docs/ui-context-menu-default-structure

- AdapTable provides a default menu structure for the Context Menu
- We describe it in detail here so that developers can easily move or remove items

AdapTable provides a large number of Menu Items which it appends to the Context Menu.

These Menu Items differ each time the Context Menu opens, based on the cell and column which was clicked.

AdapTable groups the Context Menu Items it provides into **five sections** (separated by menu dividers):

A separator is provided between each section when that section has visible items

1. **Export**
2. **Actions** (cell / column actions from multiple modules)
3. **UI Components** (Settings Panel and Dashboard)
4. **Editing** (Smart Edit and Bulk Update)
5. **Grid & column related** (Grid sub-menu and Column Info)

- The list below shows **all** Context Menu items AdapTable can provide and how they are arranged by default (`AgGridMenuAdapter.buildContextMenuDefaultStructure`)
- The menu displayed varies according to [Entitlements](https://www.adaptabletools.com/docs/handbook-permissioning/index.md), module visibility, and the nature / data type / editability of the cell and column
- Explicit parent group names include `export-group`, `column-filter-group`, `dashboard-group`, `edit-group`, and `grid-group`

## Export Section

This section contains export actions from the [Export](https://www.adaptabletools.com/docs/handbook-exporting/index.md) module.

| Label (typical) | Name (parent)  | Module | When displayed                                        |
| --------------- | -------------- | ------ | ----------------------------------------------------- |
| Export          | `export-group` | Export | Module visible and column is not the row-group column |

When more than one report menu is returned, AdapTable wraps them under a single parent labelled **Export** (`export-group`). A single visible report is shown without that parent.

The parent opens a sub-menu with **one entry per available report** (system reports plus any custom reports in state). Each report sub-menu lists **formats**, and each format lists **destinations**.

### System reports

| Report name (label) | Menu name prefix        | When omitted                        |
| ------------------- | ----------------------- | ----------------------------------- |
| All Data            | `export-all-data`       | Never (when Export is visible)      |
| Current Layout      | `export-current-layout` | Never                               |
| Selected Data       | `export-selected-data`  | Omitted when the grid is not cell- or row-selectable |

Export uses three system report roots — **All Data**, **Current Layout**, and **Selected Data** (when selection is supported).

### Formats and destinations

Formats (labels in the menu): `Excel`, `VisualExcel`, `CSV`, `JSON`.

Destinations depend on format:

| Format      | Destinations (labels) | Typical menu suffix                 |
| ----------- | --------------------- | ----------------------------------- |
| Excel       | Download only         | `-excel-download`                   |
| VisualExcel | Download only         | `-visualexcel-download`             |
| CSV         | Download, Clipboard   | `-csv-download`, `-csv-clipboard`   |
| JSON        | Download, Clipboard   | `-json-download`, `-json-clipboard` |

Leaf item names follow:

`export-{report-name}-{format}-{destination}`

(with spaces in report/format names replaced by hyphens and lower-cased — see `ExportModule.getMenuItemName`).

### Example Export menu tree (system reports)

All items are provided by the [Export](https://www.adaptabletools.com/docs/handbook-exporting/index.md) module. **Selected Data** appears only when the grid supports selection.

- Export (`export-group`)
  - All Data (`export-all-data`)
    - Excel → Download (`export-all-data-excel-download`)
    - VisualExcel → Download (`export-all-data-visualexcel-download`)
    - CSV → Download, Clipboard
    - JSON → Download, Clipboard
  - Current Layout (`export-current-layout`)
    - (same format / destination pattern)
  - Selected Data (`export-selected-data`) — when active
    - (same format / destination pattern)

Custom reports use the same naming pattern with their report name in the middle segment.

There is **no** separate `export-visual-data` report — visual export is the **VisualExcel** format.

There is **no** `table` destination — only **Download** and **Clipboard** (and Excel / VisualExcel do not offer Clipboard).

## Actions Section

Flat items and small auto-generated parents (when a module returns more than one item) from these modules, in this order:

| Label (typical)                   | Name                                                | Module                                                                     | When displayed                                                                          |
| --------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| Edit Calculated Column            | `calculated-column-edit`                            | [Calculated Column](https://www.adaptabletools.com/docs/handbook-calculated-column/index.md) | Calculated column; single selected cell; module editable                                |
| Delete Calculated Column          | `calculated-column-delete`                          | Calculated Column                                                          | Same as Edit; only when the column can be deleted                                       |
| Show Formula                      | `calculated-column-show-formula`                    | Calculated Column                                                          | Calculated column; single selected cell; formula trace not disabled                     |
| Set Note Type                     | `note-type`                                         | [Notes](https://www.adaptabletools.com/docs/handbook-notes/index.md)                         | Cell already has a Note; placed immediately after AG Grid's `note` item                 |
| Add Comment                       | `comment-add`                                       | [Comments](https://www.adaptabletools.com/docs/handbook-comments/index.md)                   | No comment thread; comments supported in layout; single cell                            |
| Remove Comment                    | `comment-remove`                                    | Comments                                                                   | Cell has a comment thread                                                               |
| Show Comment                      | `comment-show`                                      | Comments                                                                   | Cell has a comment and `showCommentAction` is `'menu'`                                  |
| Filter on Cell Value(s)           | `column-filter-on-cell-value`                       | [Column Filter](https://www.adaptabletools.com/docs/handbook-column-filter/index.md)         | Column filterable; Adaptable filtering on; no filter on column; single column selection |
| Clear Filter                      | `column-filter-clear`                               | Column Filter                                                              | Column already has a filter (see below)                                                 |
| Suspend Filter / Unsuspend Filter | `column-filter-suspend` / `column-filter-unsuspend` | Column Filter                                                              | Column has a filter                                                                     |
| Clear Flashing Cell               | `flashing-cell-clear`                               | [Flashing Cell](https://www.adaptabletools.com/docs/handbook-flashing-cell/index.md)         | Cell is flashing (cell target)                                                          |
| Clear Flashing Row                | `flashing-row-clear`                                | Flashing Cell                                                              | Row is flashing (row target)                                                            |
| Clear Alert                       | `alert-clear`                                       | [Alerts](https://www.adaptabletools.com/docs/handbook-alerting/index.md)                     | Cell or row highlighted by an alert                                                     |
| Broadcast …                       | `fdc3-broadcast`                                    | [FDC3](https://www.adaptabletools.com/docs/handbook-fdc3/index.md)                           | Column configured for broadcast (`label` includes context type)                         |
| Raise …                           | `fdc3-raise-intent`                                 | FDC3                                                                       | Column configured for raise intent (`label` includes intent type)                       |

- Add / Edit / Remove / View Note come from AG Grid's `note` context-menu item (requires [NotesModule](https://www.adaptabletools.com/docs/getting-started-aggrid-modules/index.md))
- AdapTable adds **Set Note Type** immediately after that item when the cell already has a Note

- When the column **already has** a filter, AdapTable returns **Clear Filter** and **Suspend** / **Unsuspend** items:
- If both are visible, they are wrapped under a parent labelled **Column Filter** (`column-filter-group`)
- When the column has **no** filter, a single **Filter on Cell Value()s** item is shown instead

## UI Components Section

### Settings Panel

From [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md) (`SettingsPanelModule`):

| Label               | Name                  | When displayed |
| ------------------- | --------------------- | -------------- |
| Open Settings Panel | `settings-panel-open` | Module visible |

### Dashboard

From [Dashboard](https://www.adaptabletools.com/docs/ui-dashboard/index.md) (`DashboardModule`). When more than one dashboard item is visible, they are grouped under:

| Label     | Name              | Type   |
| --------- | ----------------- | ------ |
| Dashboard | `dashboard-group` | Parent |

| Label     | Name                  | When displayed                              |
| --------- | --------------------- | ------------------------------------------- |
| Configure | `dashboard-configure` | Module editable                             |
| Expand    | `dashboard-expand`    | Dashboard has tabs and is collapsed         |
| Collapse  | `dashboard-collapse`  | Dashboard has tabs and is expanded          |
| Dock      | `dashboard-dock`      | Dashboard is floating                       |
| Float     | `dashboard-float`     | Dashboard is docked and floating is allowed |
| Hide      | `dashboard-hide`      | Dashboard is visible                        |
| Show      | `dashboard-show`      | Dashboard is hidden                         |

## Editing Section

From **Bulk Update** and **Smart Edit**, combined under an **Edit** parent when both are visible (`edit-group`). 

If only one applies, that item is promoted to the root (no **Edit** parent)

- **Smart Edit** requires a **numeric**, non row-grouped column, single-column selection, and selected cells
- **Bulk Update** works on any editable, non row-grouped column type with a suitable selection

| Label             | Name                | Module                                                                 | When displayed                                         | Type                                |
| ----------------- | ------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------ | ----------------------------------- |
| Edit              | `edit-group`        | —                                                                      | Numeric editable column with both items below          | Parent                              |
| Apply Bulk Update | `bulk-update-apply` | [Bulk Update](https://www.adaptabletools.com/docs/handbook-editing-bulk-update/index.md) | Editable column; cells selected; single column         | Child (listed first under **Edit**) |
| Apply Smart Edit  | `smart-edit-apply`  | [Smart Edit](https://www.adaptabletools.com/docs/handbook-editing-smart-edit/index.md)   | Numeric editable column; cells selected; single column | Child                               |

## Grid & Column Related Section

### Grid sub-menu

Layout, Cell Summary, Data Import, System Status, and Grid Info items are nested under a **Grid** parent (`grid-group`):

| Label                   | Name                     | Module                                                                     | When displayed                                                |
| ----------------------- | ------------------------ | -------------------------------------------------------------------------- | ------------------------------------------------------------- |
| Grid                    | `grid-group`             | —                                                                          | Always (when any child is visible)                            |
| Clear Selected Cells    | `layout-clear-selection` | [Layout](https://www.adaptabletools.com/docs/handbook-layouts/index.md)                      | Cells or rows are selected                                    |
| Select Grid             | `layout-select-all`      | Layout                                                                     | `gridApi.isGridRangeSelectable()`                             |
| Auto Size               | `layout-auto-size`       | Layout                                                                     | Always (within Layout items)                                  |
| Edit Layout             | `layout-edit`            | Layout                                                                     | Module editable and current layout not read-only              |
| Expand Aggregated Value | `layout-aggregated-view` | Layout                                                                     | Pivot layout; single selected cell; pivot/number column rules |
| See Cell Summary        | `cell-summary-show`      | [Cell Summary](https://www.adaptabletools.com/docs/handbook-summarising/index.md)            | **Numeric** column; cell(s) selected                          |
| Import Data             | `data-import`            | [Data Import](https://www.adaptabletools.com/docs/handbook-importing/index.md)               | Module visible                                                |
| Show System Status      | `system-status-show`     | [System Status](https://www.adaptabletools.com/docs/handbook-system-status-message/index.md) | Module visible                                                |
| Grid Info               | `grid-info-show`         | [Grid Info](https://www.adaptabletools.com/docs/ui-settings-panel-grid-info/index.md)       | Module visible                                                |

Child order inside **Grid** matches `AgGridMenuAdapter.getLayoutContextMenuStructure`:
- Layout (first selection actions, then other items)
- Cell Summary
- Data Import
- System Status
- Grid Info

### Column Info

| Label       | Name               | Module                                                                  | When displayed                            |
| ----------- | ------------------ | ----------------------------------------------------------------------- | ----------------------------------------- |
| Column Info | `column-info-show` | [Column Info](https://www.adaptabletools.com/docs/ui-settings-panel-column-info/index.md) | Module visible (root item after **Grid**) |
