Guides
importOK provides various options to customize the wizard to meet your needs. For example you can provide a custom title for the wizard or even a sample import file, to help your users getting started.
By default the title displayed at the top left corner of the wizard is called "Import". You can overwrite this by providing the title
as illustrated in the example below. On top of that, you can also customize the text being displayed right below the title. The corresponding option is called subtitles
.
1ImportOK.add( 2 document.getElementById('my-app-element'), 3 { 4 fields: {...}, 5 meta: {...}, 6 title: 'My custom title', 7 subtitles: [ 8 'Upload your file to get started', 9 'Match source to target columns',10 'Review validation errors and fix your data',11 'Please do not close this window during the import process.',12 ]13 }14);
To help your users getting started your can provide a sample file, as a CSV or Excel. The sampleFile
must point to a valid location - both relative and absolute URLs are accepted.
1ImportOK.add(2 document.getElementById('my-app-element'),3 {4 fields: {...},5 meta: {...},6 sampleFile: '/sample.csv' 7 }8);
In addition to the available webhooks, the following JavaScript events are provided to help you monitor user navigation between steps in the wizard, but also to track the import progress.
onImportProgress
Description | Triggered when the progress changes. |
---|---|
Event props |
|
onStepEnter
Description | Triggered when the user enters a new step of the wizard. |
---|---|
Event props |
|
onStepExit
Description | Triggered when the user is about to exit the current step. |
---|---|
Event props |
|
Here is a simple example on how you can use the above events:
1{ 2 fields: {...}, 3 onStepEnter: function (step, previousStep) { 4 console.log(`Step ${step} entered, from ${previousStep}`); 5 }, 6 onStepExit: function (step, nextStep) { 7 console.log(`Step ${step} exited, going to ${nextStep}`); 8 }, 9 onImportProgress: function (processed, failed, total) {10 console.log(`Processed: ${processed} of ${total} (${failed} failed)`);11 }12}