Skip the confirmation step and import data directly
Skip the confirmation step and import data directly
Hi,
How would you skip the third step form this example:
https://editor.datatables.net/examples/extensions/import.html
And after checking the columns align correctly, immediately import the data, skipping the multiedit form?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
In the example it uses:
The easiest option is to add
editor.submit()
after thefor
loop. That will immediately submit the form.Allan
Perfect and simple.
Would there be an easy way to hide the second step too? I would like to have it, but probably present it conditionally, so looking for something similar which I could then adjust into an if statement, but just knowing where the submit would go would get me there.
Sure - when it calls
selectEditor.create({
you can pass in a second argument after the object -false
. That will cause the form not to show.Allan
Hmm, but that doesn't seem to still submit the data to the table, just hides all the steps.
The goal is that under certain conditions (known file) to just upload and let it come straight into the table, while on others offer the ability to map still. In both cases the data should still get to the table.
Oh yes, sorry, I forgot to say that you'd need to submit it as well, similar to what was done for the other form!
Allan
Hmm. I think i am missing something:
You'd need to put it after the
submitComplete
event listener is added. Otherwise it will submit before that listener is active.Allan
I still think I am missing something, the listener is for the third page I thought?
If I insert it there I still get the same result:
Sorry I am having trouble wrapping my head around this.
I think what Allan is saying is to do this:
That way the
submitComplete
event is established before using submit.Kevin
Ah, so obvious!!! I have been trying to insert it all over and could have sworn I tried there. The outside perspective is allows useful when too close I guess.
Thank you Allan for putting up with me and Kevin for bringing it home!