Action Columns
Summary
- AdapTable allows developers to define Action Columns which are:
- Special columns that contain customisable buttons for performing bespoke row-based actions
- The button is an Adaptable Button which is very flexible and configurable
- Multiple Buttons can be displayed as required
Action Columns are special columns which display a Button (or Buttons) with a user-defined action.
The Button can be styled and configured in many ways. It is defined by developers at design-time and rendered by AdapTable at run-time.
Hint
Buttons can be provided with Action Column Commands for common use case (e.g. edit, delete, clone)
Action Columns do not exist in the underlying AG Grid data source but are still stored with Adaptable State.
Note
- Action Columns - like Calculated Columns and Free Text Columns - are not "normal" data columns
- Instead they are created dynamically by AdapTable each time the Application runs
- By contrast Styled Columns are "normal" data columns, albeit ones which AdapTable specially renders
Once created, Action Columns can be used and managed like any other Column in AG Grid and AdapTable.
Caution
Action Columns can't be created, edited or deleted in AdapTable UI, but can be moved, hidden, or added to a Layout
- In this example we define 2 Action Columns:
Update Stars- renders a single button which increments or decrements
Github StarsColumn, with logic to change the text, style, visibility and disabled state of the button labelandbuttonStyleboth change based on whether theLanguageis JavaScripthiddenwhen theNameis stencil or polymerdisabledif fewer than 200Github Watchers
- renders a single button which increments or decrements
TS- renders a button which opens the TypeScript documentation
hiddenwhen theLanguageis not TypeScript- contains only an icon (and no visible button style)
AdapTable Buttons
Action Columns are essentially powerful wrappers around Adaptable Button.
AdapTable Buttons have many properties (most available also as functions) which provide full control over:
- the Button's text
- how the Button looks
- an optional icon
- whether or not the Button is visible in a given row
- whether or not the Button is disabled in a given row
- what happens when the Button is clicked
Deep Dive
How Action Columns Work in AdapTable
Multiple Buttons
An Action Column can contain more than one button if required.
Note
There is no limit on the number of Buttons in an Action Column
- In this example we define 2 Action Columns, that each contains 2 buttons:
Update Issues: containsUpandDownbuttons that increment / decrement theIssue Changecolumn respectivelyManage Row: containsAddandDeletebuttons to add / delete Rows (and is pinned to the right in the Layout)
- Note: The same functionality could be achieved in the first Action Column by using Plus Minus and for the second by using Action Column Commands
Column width
Use actionColumnSettings to control how wide the column is:
| Property | Purpose |
|---|---|
width | Fixed width in pixels (overrides autoWidth and minWidth) |
minWidth | Minimum width; also used as the column width when autoWidth is false |
autoWidth | Estimates width from button labels/icons (or the dropdown label) at setup time |
Note
autoWidthuses static labels and icons only. Iflabel,icon,hidden, ordisabledare functions, setwidthexplicitly.- Layout
AutoSizeColumnsdoes not replace action-column width calculation — configure the action column directly.
Button layout
Icon position
Set iconPosition on any Adaptable Button inside an action column:
{
label: 'Forward',
iconPosition: 'end', // label before icon (default is 'start')
icon: { name: 'arrow-right' },
onClick: (button, context) => { /* ... */ },
}Dropdown mode
When several actions would crowd the row, set displayMode: 'dropdown'. All buttons appear in a single menu:
actionColumnSettings: {
displayMode: 'dropdown',
dropdownLabel: 'Manage',
autoWidth: true,
},
actionColumnButton: [
{ label: 'Increment', onClick: /* ... */ },
{ command: 'edit' },
{ command: 'delete' },
],Note
What applies in dropdown mode
| Property | Trigger button (dropdownLabel) | Menu items (each actionColumnButton) |
|---|---|---|
label | Yes — trigger text | Yes — row text |
icon | No | Yes — icon column (left of label) |
tooltip | No | Used as fallback if label is empty |
onClick / command | No | Yes |
hidden / disabled | No | Yes |
buttonStyle | No — trigger uses fixed outlined / neutral | No |
iconPosition | No — chevron is always after the trigger label | No — menu layout is always icon then label |
So buttonStyle and iconPosition on individual buttons only take effect when displayMode is 'buttons' (the default). In dropdown mode, styling is deliberately uniform: one trigger plus a standard list.
- One Manage trigger opens a menu with increment, decrement, edit, and delete actions
autoWidthsizes the column from the dropdown label
Leveraging Action Columns
AdapTable automatically creates Action Columns in 2 additional use cases:
- when using FDC3 to make it easy to raise Intents and broadcast Contexts
- if adding Action Buttons to the Data Change History Monitor
FAQ
Can we edit Action Columns at runtime? No, Action Columns can only be provided and configured at design time.
Can we refer to the Action Column in our AG Grid Column Definitions (e.g. to put it in a Column Group)?
Yes, you can do that. This will allow you to add AG Grid properties to the column (e.g. a Tooltip)
You must ensure the colId matches the Action Column columnID and to add a Column Type of actionColumn
Can I have more than one button in an Action Column? Yes, there is no limit to the number of buttons an Action Column can contain
AdapTable Resources
- Adaptable Button - the button(s) displayed inside an Action Column