Action Column Forms
Summary
- A
formControl opens an Adaptable Form in a popover - It is the same Form used in Alerts, Export Destinations, Data Sets and Custom Toolbars
getInitialDataseeds the fields from the row- Form buttons receive
context.formDataplus the Action Column context
A form Control is for editing a few related fields without leaving the grid — counts, a status change, a short comment.
The form property is a standard AdaptableForm — the same object used for Alert messages, Custom Export Destinations, Data Sets and Custom Toolbar forms. See Adaptable Forms for full details on titles, fields, validation and buttons.
Use getInitialData to seed those fields from the row. Form buttons receive context.formData plus the Action Column context, so they can write back to the row.
Developer Guide
Defining a Form Control
actionColumnOptions: {
actionColumns: [
{
columnId: 'edit_counts',
friendlyName: 'Counts',
controls: [
{
type: 'form',
label: 'Edit',
icon: {name: 'edit'},
getInitialData: (context) => ({
open_issues_count: context.data.open_issues_count,
closed_issues_count: context.data.closed_issues_count,
open_pr_count: context.data.open_pr_count,
closed_pr_count: context.data.closed_pr_count,
}),
form: {
title: 'Edit counts',
fields: [
{name: 'open_issues_count', label: 'Open Issues', fieldType: 'number'},
{name: 'closed_issues_count', label: 'Closed Issues', fieldType: 'number'},
{name: 'open_pr_count', label: 'Open PRs', fieldType: 'number'},
{name: 'closed_pr_count', label: 'Closed PRs', fieldType: 'number'},
],
buttons: [
{
label: 'Save',
onClick: (_button, context) => {
[
'open_issues_count',
'closed_issues_count',
'open_pr_count',
'closed_pr_count',
].forEach((field) => {
context.rowNode.setDataValue(
field,
Number(context.formData[field])
);
});
},
},
],
},
},
],
},
],
},Put the Column in actionColumnOptions.actionColumns.
Supply columnId and an optional friendlyName.
Set type to 'form'. label and icon become the trigger that opens the popover.
getInitialData copies values from the current row into the Form fields.
form.fields is a standard AdaptableForm field list.
Form buttons receive context.formData and can write back to the row.
Countsopens a Form seeded from Open / Closed Issues and Open / Closed PRs- Save writes the four values back to the row