Action Column Commands
Summary
- A
commandControl runs a built-in Row action - The 4 Commands are
create,clone,editanddelete - 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:
| Command | Action when clicked |
|---|---|
create | Opens the Create Row Form |
clone | Opens the Clone Row Form |
edit | Opens the Edit Row Form |
delete | Triggers 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',
},
],
},
],
},Put the Column in actionColumnOptions.actionColumns.
Supply columnId and an optional friendlyName.
Each Command Control has type: 'command'.
command is 'create', 'clone', 'edit' or 'delete'.
Add an optional label to place next to the icon.
Provide an icon for the Command button.
AdapTable renders the default icon if none is provided.
- The
ActionsColumn contains 3 Command Controls:CloneEditDelete
Pinning Command Columns
Action Columns can use standard Column Pinning so the Command stays visible.
Editis pinned left (with a label)Deleteis pinned right
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
BaseControlproperties as every other Action Column Control - i.e.
label,style,icon,hidden,disabled, and optionalconfirm
cloneis hidden whenLanguageis TypeScript (and has a custom icon)editis disabled whenLanguageis HTMLdeletetone changes whenLanguageis JavaScript