Action Column Commands

View as Markdown

Summary

  • A command Control runs a built-in Row action
  • The 4 Commands are create, clone, edit and delete
  • Most of these are shortcuts to open the matching AdapTable Row Form

Action Columns can be provided with a Command Button.

This is a built-in alternative to wiring up a custom onClick yourself.

Note

These are designed to cater for the most common use cases and to reduce development overhead

AdapTable provides 4 Action Column Commands, which open the matching Row Form:

CommandAction when clicked
createOpens the Create Row Form
cloneOpens the Clone Row Form
editOpens the Edit Row Form
deleteTriggers the (non-visible) Delete Row Form

Hint

If no icon is provided, AdapTable uses a default one for that Command.

Developer Guide

Defining Command Controls

actionColumnOptions: {
  actionColumns: [
    {
      columnId: 'action',
      friendlyName: 'Actions',
      controls: [
        {
          type: 'command',
          command: 'clone', // opens Clone Row Form
          icon: {name: 'pie-chart'},
        },
        {
          type: 'command',
          command: 'edit', // opens Edit Row Form
          label: 'Edit',
        },
        {
          type: 'command',
          command: 'delete', // triggers Delete Row Form event
          label: 'Delete',
        },
      ],
    },
  ],
},
1
Add Action Column Options

Put the Column in actionColumnOptions.actionColumns.

2
Identify the Column

Supply columnId and an optional friendlyName.

3
Set the Control type

Each Command Control has type: 'command'.

4
Choose the Command

command is 'create', 'clone', 'edit' or 'delete'.

5
Provide a label (optional)

Add an optional label to place next to the icon.

6
Supply an Icon (optional)

Provide an icon for the Command button.

AdapTable renders the default icon if none is provided.

Action Column Commands
Fork
  • The Actions Column contains 3 Command Controls:
    • Clone
    • Edit
    • Delete
Loading demo…

Pinning Command Columns

Action Columns can use standard Column Pinning so the Command stays visible.

Action Column Commands Pinned
Fork
  • Edit is pinned left (with a label)
  • Delete is pinned right
Loading demo…

Configuring Commands

Command Buttons are very configurable - style, label, visibility etc can all be set on a per-row basis.

Note

  • The Command Controls use the same BaseControl properties as every other Action Column Control
  • i.e. label, style, icon, hidden, disabled, and optional confirm
Configuring Action Column Commands
Fork
  • clone is hidden when Language is TypeScript (and has a custom icon)
  • edit is disabled when Language is HTML
  • delete tone changes when Language is JavaScript
Loading demo…