Import Technical Reference

View as Markdown

Data Import Options

DataImportOptions

Options for managing the Data Import function

Custom File Handlers to use for Data Import

Function to handle the Imported Data and apply it to the Grid. If not provided then the Data will be applied to the Grid automatically.

textHandler?

(text: string) => T[] | Promise<T[]>

Handles Importing Data using text

Function to validate the Imported Data

_getPrimaryKeyValue?

(context:GetPrimaryKeyValueContext<T>) => string | number

Function to get the Primary Key value for a data row (defaults to value of the primaryKey column)

It might change in a future version

_preprocessRowData?

(context:PreprocessRowDataContext<T>) => Record<string, any>

Function to pre-process the data before it is imported

It might change in a future version

fileHandlers entries are a DataImportFileHandler:

handleImportedData receives a HandleImportedDataContext:

validate receives a DataImportValidateContext and returns DataImportValidationError objects:


Data Import API


Data Imported Event

The Data Imported Event is published whenever data has been imported.

DataImportedInfo

The DataImportedInfo object returned by the Event contains details of the rows which have been added and / or updated by the Import.

DataImportedInfo

Payload of the DataImported event.

Fires after a data import has been applied to the grid.

Extends , so adaptableApi is included.

addedRows

IRowNode[]

Row nodes created by this import.

Raw rows that were imported, before they were matched to grid rows.

updatedRows

IRowNode[]

Existing row nodes updated by this import.

Custom application Context provided in AdaptableOptions.adaptableContext

Event Subscription

Subscribing to the Event is done the same way as with all Adaptable Events:

api.eventApi.on('DataImported', (eventInfo: DataImportedInfo) => {
    // do something with the info
});