Column Menu
The Column Menu appears in every column in AdapTable and provides quick access to useful functionality. It contains a mix of entries applicable either to the current Column or to the Grid as a whole.
note
If you are using ag-Grid Enteprise (with the correct modules) then AdapTable will insert its column menu items into the ag-Grid menu.
If you are using ag-Grid Community or dont have access to the ag-Grid column menu, AdapTable will create a bespoke menu for you.
The options in the menu vary depending on the data type of column and the current state of that column. For example, only numeric columns have a Flashing Cell menu item, and if the column is already set to display flashing cells, the Turn Flashing Cell On option is replaced by Turn Flashing Cell Off.
The Column Header Menu is accessed by clicking the 3 horizontal lines in the Column Header.
tip
To make the 3 horizontal lines always visible in the Column Header set suppressMenuHide to true in GridOptions.
Column Menu Entries
There are 3 types of menu entries that can appear in the Column Menu:
- Vendor Grid Column Menu Entries - shipped by the underlying Vendor Grid
- System Column Menu Entries - shipped by AdapTable (which you can choose to hide)
- User Column Menu Entries - provided by developers at run-time (with functions available for you to control where and when they appear)
Items Order
The default order for displaying the 3 sections is: 'vendor', 'adaptable', 'user'.
However this can easily be changed via the columnMenuOrder
property in User Interface Options.
caution
When setting this property, ensure to include all 3 values, as missing entries will be absent from the menu
System Column Menu Entries
AdapTable, by default, includes a number of entries in the Column Menu.
Each entry is associated with a different AdapTable Function - this makes it easy for developers to exclude those entries they dont wish to appear (see below for more details).
note
Because there are 3 Dashboard related Menu Items they are grouped into a single Sub Menu
The full list of System Column Menu Entries is:
Menu Entry | Adaptable Function | Where Displayed |
---|---|---|
Dashboard - Configure | Dashboard | All Columns |
Dashboard - Expand / Collapse | Dashboard | All Columns |
Dasbhoard - Dock / Float | Dashboard | All Columns |
Edit Calculated Column | Calculated Column | Calculated Columns |
Create Cell Validation Rule | Cell Validation | All Columns |
Create Conditional Style | Conditional Style | All Columns |
New / Edit Custom Sort | Custom Sort | All Columns |
Show / Hide Quick Filter Bars | Filter | All Columns |
Clear Filter | Filter | Currently Filtered Columns |
Turn Flashing Cell Off / On | Flashing Cells | Numeric Columns |
New / Edit Format Column | Format Column | All Columns |
Edit Free Text Column | Free Text Column | Free Text Columns |
New / Edit Gradient Column | Gradient Column | Numeric Columns |
Show Info - Grid | Grid Info | All Columns |
Show Info - Column | Grid Info | All Columns |
Edit Layout | Layout | All Columns |
Hide Column | Layout | All Columns |
Select - Column | Layout | All Columns |
Select - Whole Grid | Layout | All Columns |
Show As / Remove Checkbox | Layout | Boolean Columns |
New / Edit Percent Bar | Percent Bar | Numeric Columns |
New Plus Minus Rule | Plus Minus | Numeric Columns |
Show System Status | System Status | All Columns |
Clear Updated Rows | Updated Row | All (if updated rows) |
Ungroup Column | Row Grouping | Row Grouped Columns |
If running the Chart Plugin the following Column Menu Entries are also available:
Menu Entry | AdaptableFunction | Where Displayed |
---|---|---|
View as Pie Chart | Chart | All Columns |
View as Sparkline | Chart | Numeric Columns |
Edit Sparkline Column | Sparkline Coumn | Sparkline Columns |
Hiding System Column Menu Entries
Developers can, at design-time, choose not to display some (or all) of the shipped Column Menu entries.
This can be done in 2 ways - both via the showAdaptableColumnMenu
property in User Interface Options:
boolean value
Simply provide a value of false (the default is true) when setting the property.
// Hide the Column Menu in ALL circumstancesadaptableOptions.userInterfaceOptions = {showAdaptableColumnMenu: false};caution
This will hide all AdapTable Column 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.
The function recieves 2 arguments (Adaptable Menu Item and Menu Info) and returns a boolean.
// Don't show System Column Menu entries for the 'counterparty' column// Don't show the 'Layout' or 'PieChart' menu entries - for any columnadaptableOptions.userInterfaceOptions = {showAdaptableColumnMenu: (menuItem: AdaptableMenuItem, menuInfo: MenuInfo) => {if (menuInfo.Column.ColumnId === 'counterparty') {return false;}if (menuItem.FunctionName === 'Layout' || menuItem.FunctionName === 'PieChart') {return false;}return true;},};
User Column Menu Entries
Developers can add their own custom entries to the Column Menu at design-time.
Each User Column Menu entry needs also to include the JavaScript function that should be invoked by AdapTable when the menu entry is selected at run-time.
As with all instances where a JavaScript function needs to be provided to AdapTable, this is done in 2 steps:
note
Predefined Config is stored as JSON so cannot include JavaScript functions (as they cannot be stringifed)
Provide a custom, named implementation of the UserMenuItemClickedFunction in the User Functions section of Adaptable Options.
Reference that function by name in the User Interface section of Predefined Config.
Hiding User Column Menu Entries
It might not always make sense for a User Column Menu entry to appear (e.g. it might be applicable only to numeric columns).
For this reason, AdapTable provides a function enabling devs to 'hide' Column Menu entries based on the current context.
note
Predefined Config is stored as JSON so cannot include JavaScript functions (as they cannot be stringifed)
This is done in a similar 2 steps to creating them:
Provide a custom, named implementation of the UserMenuItemShowPredicate in the User Functions section of Adaptable Options.
Reference that predicate by name in the User Interface section of Predefined Config.
Editing User Column Menu Entries
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, AdapTable provides a function enabling devs to change the label of a Menu Entry based on the current context.
note
Predefined Config is stored as JSON so cannot include JavaScript functions (as they cannot be stringifed)
This is done in a similar 2 steps to creating them:
Provide a custom, named implementation of the UserMenuItemLabelFunction in the User Functions section of Adaptable Options.
Reference that predicate by name in the User Interface section of Predefined Config.
tip
If the function returns an empty string then AdapTable will revert to using the value of the Label property