Blank table to use for bulk imports
Blank table to use for bulk imports
Hi,
I have something I need to find a solution to, and I'm wondering if Datatables + Editor can handle it.
Basically, we need a way for people to scan or type in information and then upload that to our db either all at once, or by using the inline feature. I had thought about creating a blank table to accomplish this. I have this created, but I have a question.
If I have column headers that match the DB but the rest of the column is blank, is there a way that I can then have users fill in the blanks and have the data write back to the corresponding column in the database? Basically, I need datatables only to POST data to the server instead of pulling data out to display.
Is this doable? Is there any other method of accomplishing bulk imports?
This question has an accepted answers - jump to answer
Answers
Hi,
Have a look at this blog post which I think will help with what you are looking for.
If you don't want DataTables to pull data from the database on load, don't include the
ajax
option in the DataTable.Regards,
Allan
Thank you! That will help me accomplish the majority of what I need here
One question remains, though, but first I'll show some code so you can see what I have:
This generates a blank table just fine, however the inline portion is not working (gives me the "Uncaught Unable to find row identifier" error), presumably because it's looking for a data source that's not there. I've reviewed the suggestions in the url appended to that error, but haven't made any headway with it.
Would I need to write a custom button that creates a query to enter data into our DB? If this is the case, what is the name of the data object created by editor? (So I can log it and tailor accordingly)
Thank you for the tremendous amount of help so far, on this and other posts. You have a great product here!
You can't use inline editing to create a new row I'm afraid. Inline editing is for edit only - the row needs to exist in the database already, which is why you are getting an error about the id not existing (it doesn't!).
If you do need to inline create a row, what you have to do is create an empty row in the database, so that Editor "thinks" that it is just editing a regular row.
Allan
p.s. Thanks for your kind words!
Ok, I think I can make that work, I can just create a new table with some blank rows and use a custom button to perform the appropriate query as a bulk action. Thanks for the explanation!