Row Forms

Summary

  • AdapTable provides dynamic Row Forms to help users to safely manage creating, cloning and editing Rows
  • Row Forms are highly configurable to meet all requirements
  • Row Form submission can be handled automatically by AdapTable or by listening to Row Form Submitted Event
  • Action Column Command Buttons can be used to dynamically open Row Forms

Row Forms allow users safely to manage row-related CRUD operations in AdapTable via a popup Form.

There are 3 Row Forms available (each of which is a specialised type of Adaptable Form):

  • Create - opens a completely empty Form with a UI control for each field in the Data Source
  • Clone - opens a Form with fields displaying copied values from the existing row
  • Edit - opens a Form showing the current values of the Row

Note

  • Row Forms can also be used to safely delete rows
  • No visible Row Form is rendered (as there is nothing to show) but the Row Form Submitted Event is still fired

Displaying Row Forms

Row Forms can be displayed via 2 methods:

Row Forms
Fork
  • This example illustrates the 2 ways to display Row Forms in AdapTable:
    • We set an Edit Action Column Command (in Action Column Options) to open the Edit Row Form for each row
    • In Dashboard Options we configure an "Add New Row" Custom Button and configure the Button's onClick event to display the Create Row Form using Row Form API
  • In Row Form Options we set 3 properties:
    • set autoHandle to true so that AdapTable will do all the actual row manipulation for us
    • set disableInlineEditing to true so that editing is not possible directly in the Grid (i.e. only in the Row Form)
    • provide an implementation for the setPrimaryKeyValue function so we can attach a valid primary key to newly created rows
  • Additionally we configure AdapTable with these Options and Initial State:

Row Form Contents

Row Forms are vertical and render a Label and relevant UI control for each Column in the AG Grid Row.

The Label displays the Column's Header and the field is an input type associcated with the Column's Data Type:

Column Data TypeInput Type
textStandard input
numberNumeric Cell Editor
dateDate Picker
booleanCheckbox

Hint

  • Read-only Columns display the field's value but no input is provided
  • If a Column has been given a Select Cell Editor, the Form displays it, populated with the Column's distinct values

Configuring Row Forms

Developers can configure Row Forms so they meet precise requirements and use cases. Options include:

  • configuring the Form's title and description
  • changing the buttons that appear (by default they are Cancel and Save)
  • adding custom buttons
  • providing a Primary Key value (useful when accessing the Add Row Form)
  • disabling inline editing - so that all editing has to use the Form

Find Out More

See Configuring Row Forms for more details

Handling Row Form Submission

In the demo above, AdapTable performed all the row management automatically.

It has added, edited or cloned the Row when the Form is submitted (and removed it when Delete is clicked).

This is perfectly suitable for most scenarios, and no additional developer / support input is required.

However, some use cases require that rows are only updated or deleted after the form has been submitted.

Note

  • This allows developers first to get details of the new / updated row and call any relevant backend services
  • They can only then update the Grid's row data collection - typically via a round trip, rather than directly

For this reason, Adaptable provides the Row Form Submitted Event which is fired:

  • whenever a Row Form is submitted
  • when a Delete Action Column Command Button is clicked

Caution

  • If using this option then set autoHandle to false in Row Form Options
  • This tells AdapTable not to do any row management itself but to leave it to the developer listening to the Event

autoHandle

Default: true
boolean
AdapTable will automatically hande all Grid changes
Row Form Events
Fork
  • This demo provides a more advanced use case for leveraging Row Forms in Adaptable
  • In Row Form Options we set 4 properties:
    • in actionRowButtons we configure 'clone', 'edit' and 'delete' buttons
    • pin 'clone' and 'edit' to left of Grid, and 'delete' to the right
    • provide an implementation for the setPrimaryKeyValue function so we can attach a valid primary key to newly created rows
    • autoHandle has been left unset, so it defaults to false - meaning we need to handle the Row Form submission
  • In Dashboard Options we configure a Custom Button which when clicked opens the Create Row form
  • Most importantly we listen to the Row Form Submitted Event and based on the type of the action we perform the Row manipulation directly
  • Note: in a more real world case you will likely call a server to do this but the key point is the separation of form submission and row-related action

FAQ

How can I check data provided in the form before it enters the AG Grid? First, ensure that autoHandle is set to false to prevent automatic entry; then listen to the Row Form Submitted Event to perform any updates yourself

AdapTable Resources