Submitting Full Row on Tab Change
Submitting Full Row on Tab Change
Hi,
I am referring to below example on Data Table for Inline editing
https://editor.datatables.net/examples/inline-editing/submitData.html
This example submit the complete row when "Return" is hit.
I want to submit the full row of data when we "Tab" out from the cell.
Is this possible in Editor? If yes, then could you please help me to achieve this?
Thanks,
Karamvir Mor
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Karamvir,
Thanks for your message. Do you want the focus to then move on to the next cell when you press tab? If so, this example which uses KeyTable to provide the key handling should work well for you.
Note you will probably also wish to set the
onBlur: 'submit'
option inform-options
object when you callinline()
.Regards,
Allan
Hi Allan,
I believe the issue is that the TAB action only sends the field that was modified (i.e. [last_name]) instead of all fields in the row being edited. In the link to the example you reference, I changed the last name for Row 6, and the Ajax Data submitted is:
The same action happens when you modify the field and hit <return> - the Ajax data submitted is only the field modified.
In the example that Karamvir referenced:
...you can edit a field, and if you hit "<return>", the entire row dataset is submitted:
In the above example, I added "Mgr." to the [position] field and hit <return> which submitted all fields in the row.
It looks like the way to submit the entire row of data is by adding the "allIfChanged" option:
...but this does not seem to work with inline-edit and a <TAB> action.
Any chance you have an example with inline-editing where a TAB out of a modified field will submit the entire row of data? We would really like to use the inline-edit feature, but my understanding from Karamvir is that our back-end handler will be easier to implement for Change or Update if we have the full row of data submitted.
Thanks for your help, Allan!
William
Hi William,
Thanks for the clarification! The way to set the
submit
option of theform-options
object when using KeyTable is to use theformOptions.inline
object. For example:The reason for this is that KeyTable calls
inline()
itself, so we need to be able to set the form options. Using the initialisation options as above is how that can be done.Regards,
Allan
Thank you for clarifying, Allan! I believe that we have this working now.
William
Hi William,
Great to hear - thanks for the update.
Allan