Action Columns

View as Markdown

Summary

  • AdapTable allows developers to define Action Columns
  • These are special columns that host interactive Controls on each row
  • There are 8 different types of controls available
  • Multiple Controls can be placed in one Column
  • Controls are defined at design-time, and rendered by AdapTable at run-time

Action Columns are special columns that display interactive Controls used for row-based actions.

They are defined by developers at design-time and rendered by AdapTable at run-time.

Note

Unlike other AdapTable features, Action Columns are only defined in AdapTable Options and never in Initial State

There are 8 Control types which can be hosted inside an Action Column:

ControltypeDescription
ButtonbuttonClickable button with an onClick handler
ToggletoggleSwitch, checkbox or toggle-button bound to a boolean
LinklinkHyperlink (href, mailto:, drill-through)
SelectselectDropdown that writes a chosen value
CommandcommandBuilt-in create, clone, edit or delete Row Form commands
MenumenuDropdown or split menu that contains other Controls
FormformOpens an Adaptable Form in a popover
CustomcustomBespoke React / Angular / Vue / HTML content

Topics in this Section

TopicDescription
Action Column ButtonsClickable buttons with onClick, confirm, and async busy state
Action Column TogglesSwitch, checkbox or toggle-button bound to a row field
Action Column LinksHyperlinks built from row data (href, target, visibility)
Action Column SelectsDropdowns that write a chosen value back to the row
Action Column CommandsBuilt-in create, clone, edit and delete Row Form commands
Action Column MenusDropdown or split menus containing other Controls
Action Column FormsAdaptable Form in a popover, seeded from the row
Custom Action ColumnsReact, Angular, Vue or HTML content via render / frameworkComponent
Configuring Action ColumnsWidth, overflow, rowScope, and AG Grid Column Definitions
Action Column OptionsOptions, Control types, and API reference

Hint

Each Control type page includes DevSteps with a full actionColumnOptions example. Action Columns are defined only in Options — not in Initial State.

Note

  • Action Columns — like Calculated Columns and Free Text Columns — are not "normal" data columns
  • They don't exist in the underlying AG Grid data source and typically don't have an AG Grid ColDef (though they can)
  • 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 are configured entirely at design-time; they can't be created, edited or deleted in AdapTable's UI
  • However, they can be moved, hidden, or added to a Layout
Action Columns
Fork
  • This demo defines one Action Column for each of the 8 Control types:
    • Stars — button increments Github Stars
    • Wiki — toggle (switch) bound to Has Wiki
    • Repo — link opens the GitHub page
    • License — select writes a new license
    • Edit — command opens the Edit Row Form
    • More — menu with increment, clone and delete
    • Notes — form popover to edit the description
    • Badge — custom chip from the language
Loading demo…

Defining an Action Column

Each Action Column (of type ActionColumn) is defined in the actionColumns property of Action Column Options.

The required pieces are:

  • columnId — how the Column is referenced in Layouts and code
  • friendlyName — header caption (falls back to columnId)
  • controls — an array of ActionColumnControl objects, each with a type
actionColumnOptions: {
  actionColumns: [
    {
      columnId: 'actions',
      friendlyName: 'Actions',
      controls: [
        {
          type: 'button',
          label: 'Run',
          onClick: (context) => {
            // ...
          },
        },
      ],
    },
  ],
},
Deep Dive

How Action Columns are Created, and Work, in AdapTable

Multiple Controls

A Column can contain as many Controls as required.

They render in the order that they are provided.

Hint

  • When they do not all fit, set settings.overflow to 'menu' — overflowing Controls collapse into a "⋯" menu.
  • See Configuring Action Columns for width, overflow, rowScope, and AG Grid Column Definitions.

Leveraging Action Columns

AdapTable creates Action Columns automatically in 2 additional use cases:

  • when using FDC3 to raise Intents and broadcast Contexts
  • if adding Action Buttons to the Data Change History Monitor

Put buttons, toggles, links or custom content on AG Grid rows — 8 Control types, configured in a few lines

Read articleBlog Post

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 AG Grid Column Definitions (e.g. to put it in a Column Group)? Yes. Match colId to the Action Column columnId and set a Column Type of actionColumn.

Can I mix Control types in one Column? Yes. An Action Column's controls array can contain any mix of the 8 types, including a menu that itself contains other Controls.