How to implement auto save and confirmation for unsaved changes with inline editing?

How to implement auto save and confirmation for unsaved changes with inline editing?

abuhilwaabuhilwa Posts: 2Questions: 1Answers: 0
edited July 1 in Free community support

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
I'm trying to implement two features in DataTables Editor using inline editing with full row activation (as shown here:
https://editor.datatables.net/examples/inline-editing/fullRowCells.html):

Auto-save when exiting inline editing, and
A confirmation message when attempting to exit without saving.
I attempted to use the example provided in this link:
https://editor.datatables.net/examples/api/confirmClose.html

However, I'm facing a couple of issues:

The confirmation message is being triggered multiple times.
The message also appears after pressing the Enter key, which should behave like clicking "Save" and not trigger a confirmation.
Could you please advise how to properly implement these features in the context of full-row inline editing?

Answers

  • allanallan Posts: 64,660Questions: 1Answers: 10,691 Site admin

    I've just put together this little example in which it appears to be working okay. Could you take a look and see if that is operating the way you wanted?

    Thanks,
    Allan

  • abuhilwaabuhilwa Posts: 2Questions: 1Answers: 0

    Hi Allan,

    I tested the functionality with my case, and it works well except for one scenario:
    When I press the Enter key to save, the confirm action is triggered unexpectedly.

    The key difference between my case and your example is that in my setup, the edit is performed via an AJAX call, which causes a refresh after a successful save. This might be affecting the behavior of the Enter key.

    Thanks,

  • allanallan Posts: 64,660Questions: 1Answers: 10,691 Site admin

    It shouldn't. I've just updated the example to do local Ajax: https://live.datatables.net/jorutoji/112/edit and it still seems to work okay.

    Can you link to the page that is having the problems perhaps?

    Allan

Sign In or Register to comment.