I am trying to create an Editor form which has a file upload, and after the file upload completes I want a field in the table for this row to be updated with the returned id for the file.
I've read https://editor.datatables.net/manual/server#File-upload and https://editor.datatables.net/reference/field/upload, and I am a little murky on how to make the association with the row's id.
If I understand correctly, the file upload happens asynchronously of the (say) create form which contains the file select field. Yet after the upload completes, I need to update the newly created row in the table with the file's id. Alternately the user may not have clicked on the Create button by the time the file upload completes, so the handling for that isn't clear to me either.
Finally (and maybe this should be a separate question), when upload occurs from the update form I'd like to replace the original file, and therefore would need to see the file's original id in the request from the client. (I'm storing these files on google drive)
Possibly I am just not understanding the documentation. Must the ajaxData
option be used? I see in https://editor.datatables.net/reference/field/upload examples that fileId
can be used for rendering, but don't see how that variable is initialized.