Adding Rows to AG Grid

Summary

  • AdapTable provides an addGridData function to add rows to AG Grid
  • This can be run synchronously or asynchronously

AdapTable facilitates adding rows to AG Grid, while the application is live.

This is done via the addGridData function in the Grid API section of Adaptable API.

Important

  • We strongly recommend using this function to add rows to AG Grid, rather than the AG Grid API directly
  • The function ultimately calls an AG Grid function but first performs important checks (e.g. for Primary Key)

This function can be run either synchronously or asynchronously as required.

Hint

There is an option to configure where in the Grid the row will be added

The addGridData function does 2 things:

  • invokes AG Grid applyTransaction function (or applyTransactionAsync if called asynchronously)

  • publishes the Row Changed Event with a Trigger of Add (which will in turn trigger any Alerts)

addGridData

dataRows: any[], config?: DataUpdateConfig
Promise<RowNode[]>
Adds new Rows to AG Grid (asynchronously if required)
Adding Row Data
Fork
  • This demo shows how to add rows in AG Grid at run-time using the addGridData function in Grid API

Add or Update

AdapTable provides a companion addOrUpdateGridData function.

This should be used when the rows received can be either new or existing.

If the primary key exists in a row, the function will call updateGridData (see Updating Grid Rows)

If the primary key doesn't exist in a row, the function will call addGridData.

addOrUpdateGridData

dataRows: any[], config?: DataUpdateConfig
Promise<RowNode[]>
Adds or Updates Rows in AG Grid (asynchronously if required)