benwinding / react-admin-import-csv

A csv file import button for react-admin

Home Page:https://benwinding.github.io/react-admin-import-csv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom importer function

enricodeleo opened this issue · comments

Is it possible to inject a custom importer function the same way we do for exporter?

Hi @enricodeleo,

What do you mean by exporter? We have the following options available to use:

const config: ImportConfig = {
  // A function to translate the CSV rows on import 
  preCommitCallback?: (action: "create" | "overwrite", values: any[]) => any[];
  // A function to handle row errors after import
  postCommitCallback?: ([]) => any[];
}
<ImportButton {...props} {...config}/> 

Any other functionality, you're better off manipulating your dataprovider.

Cheers,
Ben

Thanks for your reply @benwinding