Configuring Row Forms
Summary
- Row Forms are types of AdapTable Form and are highly configurable
AdapTable Form
The Row Form displayed by AdapTable is a specialised Adaptable Form which renders one row for each data element in the Data Source
Note
AdapTable will provide the appropriate edit input for the Column's Data Type (if the cell / column is editable)
Included Columns
By default AdapTable will include every Column in the Grid in the Row Form.
This can be configured by using the includeColumnInRowForm property in Row Form Options which determines inclusion a case by case basis.
includeColumnInRowForm
Default: true (all columns)(context) => booleanForm Title
rowFormTitle
Default: 'Create New Row' / 'Edit Row'string | ((context: RowFormTitleContext) => string)
Form Description
rowFormDescription
string | ((context: RowFormTitleContext) => string)
Default Buttons
By default AdapTable will display 2 Buttons at the bottom of the Form:
- Save - automatically saves the Row (for
Editbuttons) or creates a new Row (forCreate&Clonebuttons)
Caution
- AdapTable will only automatically perform these actions if
autoHandleis set to true in Row Form Options- If false, developers need to handle, as required, the Row Form Submitted Event which AdapTable fires
- Cancel - closes the Form with no changes made
Custom Buttons
rowFormButtons
AdaptableButton[]
- This demo illustrates how to configure the Edit Row Form. In
rowFormOptionswe provide many properties including:includeColumnInRowForm- we exclude theActionsColumn (that displays theAddButton) and theIdColumn from the displayed formrowFormTitle- we provide a custom Title based on the Row being editedrowFormDescription- we provide a custom Description that appears below the Form TitlerowFormFieldLabel- we change the text of the Label forLanguageColumnrowFormButtons- we provide 2 Custom Buttons that display at the end of the Form and have custom Styles;Cancel- displays an Alert when clickedSave- has a custom Label which references the Row, and updates the Grid when clicked (button is disabled where Issue Change is negative)
- Note: we set
autoHandleto false since we are providing the functionality to update the Grid
Disabling In-line Editing
AdapTable can be configured so that the only editing allowed is through the Row Form, i.e. not directly inline in the cell itself.
This is achieved by setting the disableInlineEditing property in Row Form Options to true.
disableInlineEditing
Default: falsebooleanCaution
Even Columns which have been directly set to be editable in Grid Options will be readonly (for inline editing)
Setting Primary Key Value
Every AdapTable instance requires a Primary Key column to be provided.
This is a column which guarantees to hold unique values.
This means that when adding a new row to the Data Set via a Row Form - either Create or Clone - it is possible that the run-time user might not know what value to provide to the Primary Key Column.
For this reason, AdapTable provides the setPrimaryKeyValue property in Row Form Options which can return a Primary Key value for the row automatically.