Import Technical Reference

Summary

  • Importing is set through Options
  • The Data Import API contains functions to manage exporting and reports programmatically
  • Import Event
  • There is no Initial Adaptable State associated with Data Import

Data Import Options

The Data Import Options section of Adaptable Options contains these properties:

PropertyTypeDescription
fileHandlersDataImportFileHandler<T>[]Custom File Handlers to use for Data Import
handleImportedData(context:HandleImportedDataContext<T>) => Promise<void |HandleImportedDataResolution>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
validate(context:DataImportValidateContext<T>) =>DataImportValidationError[] | undefinedFunction to validate the Imported Data
_getPrimaryKeyValue(context:GetPrimaryKeyValueContext<T>) => string | numberFunction to get the Primary Key value for a data row (defaults to value of the primaryKey column)
_preprocessRowData(context:PreprocessRowDataContext<T>) => Record<string, any>Function to pre-process the data before it is imported

Data Import API

The Data Import API section of Adaptable API contains just one function which starts the Data Import Wizard:

MethodReturnsDescription
openImportWizard()voidOpens the Data Import Wizard

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.

PropertyTypeDescription
addedRowsIRowNode[]Rows that were added
importDataany[]Raw data that was imported
updatedRowsIRowNode[]Rows that were updated
adaptableContextanyCustom 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
});