In the import CSV example, the 'choose file...' button appears to only work once for some browsers

In the import CSV example, the 'choose file...' button appears to only work once for some browsers

bg7bg7 Posts: 15Questions: 2Answers: 0

We've been able to replicate this issue using the CSV import example here:

https://editor.datatables.net/examples/extensions/import.html

If you import records into a DataTable using the Import CSV example the "Choose file..." button that appears after clicking the "Import CSV" button only works the first time in Chrome, Safari and Edge. This issue doesn't happen in Firefox. We've seen it on both Mac and Windows. There are no errors in the console.

I exported a couple of rows to import back into the table. This works just fine the first time through. If I then click "Import CSV" a second time and then click the "Choose file..." button I can select the file but it doesn't seem to do anything and the import screen for mapping fields doesn't appear. It instead stays on the screen with the "Choose file..." button. It's also possible to replicate this issue without doing the actual import. Simply getting to the screen to map the fields, canceling out of it and then going to import and select the file again causes it to happen. Reloading the page resets the behavior and browsers that weren't working will work again, once. Dragging and dropping the file to the area below the "Choose file..." button does reliably work though.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 53,362Questions: 1Answers: 8,250 Site admin

    Thanks for letting me know about this. I'll get this sorted (DD-1883 in our internal tracker) and post back here when done.

    Allan

  • allanallan Posts: 53,362Questions: 1Answers: 8,250 Site admin
    Answer ✓

    I've got this figured out now - I'd missed a callback in the ajax function for the upload field which wasn't telling Editor that the upload was complete. To fix, in the example, the ajax line for the upload field should be:

    ajax: function ( files, done ) {
    

    And then at the end of the complete function for Papa parse use done([0]); and that will fix this issue. I'll update the example on the site shortly.

    Regards,
    Allan

  • bg7bg7 Posts: 15Questions: 2Answers: 0

    Allan,

    Works great. Thanks!

    Ben

Sign In or Register to comment.