SubmitOnBlur when data is not changed.

SubmitOnBlur when data is not changed.

MytkoMytko Posts: 8Questions: 0Answers: 0

Hi Allan.
I am using submitOnBlur and I do not want submit data, when they are not changed. Is it possible configure such behaviour?

thank

M.

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi,

    There isn't a built in way of doing this at the moment - but what you could do is use initEdit and preSubmit to check the value to be submitted against the value of the field when it was put into edit mode (stored in a variable using the initEdit event). If it is found to be the same call close() and return false from the function.

    Allan

  • MytkoMytko Posts: 8Questions: 0Answers: 0
    edited October 2014

    thanks, it works!

  • vedran.blazevicvedran.blazevic Posts: 11Questions: 1Answers: 0
    edited December 2014

    Dear Allan.

    I have solved the same problem with your proposed solution. Thanks for that.

    However I have one more related issue:

    I am also using tabbing through the columns as described in the corresponding example.

    So basically, every time I tab out of a field, I would like the field to be submitted and the next field should be focused.
    This works fine as long as a change takes place.

    However, if there is no change, I close and return false on preSubmit, the field just closes and the next one is not opened.

    Is there any way to work around this?

    Best regards and thanks in advance.

    Vedran

    P.S.:
    If I perform the click event on the next cell twice (in the tabbing logic), the cell is finally opened.
    This is however no viable solution.

  • vedran.blazevicvedran.blazevic Posts: 11Questions: 1Answers: 0

    The problem in my last post seems to be solved with the workaround explained by sagimann in this thread

    https://datatables.net/forums/discussion/24518/inline-editing-with-tab-between-columns-undoes-values

    at the moment, I found a solution of calling "editor.submit()' from within the on() method that processes the tab clicks. seems to work for now, we'll see...

This discussion has been closed.