Datatable - Editor : setting editOnfocus option posting data to server randomly

Datatable - Editor : setting editOnfocus option posting data to server randomly

SairaSaira Posts: 7Questions: 3Answers: 0

Hi,

We have to open the editor on focus but post data to server only when user makes some changes or type in the field. We are able to achieve this feature with **editOnFocus ** option but data is being posted randomly to server while only navigating the table and making no change.

We observed the same behavior on tabbed column example screen, on reaching the 3rd row it submit few next columns and rest works fine.

Answers

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    Can you possibly give me instructions on how to recreate the issue on that page please? I've tried focusing on the "Airi" cell and then just tabbing through the table, but wasn't able to reproduce the issue.

    Thanks,
    Allan

  • SairaSaira Posts: 7Questions: 3Answers: 0

    I changed the column in that row and left it blank on tabbed column screen.

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    I'm really sorry, but I don't quite understand. Could you give me explicit step by step instructions please?

    Thanks,
    Allan

  • SairaSaira Posts: 7Questions: 3Answers: 0
    edited January 2018

    We encountered this issue on tabbed column page when a field is edited and left blank, as in the attached screenshot Salary column of third row is empty. But on our page we were encountering it randomly.
    We applied the unsaved changes confirmation trick in preSubmit to avoid unnecessary server posts.

    Thanks

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    So on this page to recreate, do I need to:

    1. Start editing a cell
    2. Make it empty
    3. Press tab
    4. Repeat 2-3?

    And it will fail? I'm still not sure on how I can recreate the issue. Can you give me the steps to do so please?

    Allan

  • SairaSaira Posts: 7Questions: 3Answers: 0

    Hi allen,

    I have created a short video clip to show the scenario. https://drive.google.com/file/d/1M4npk0NkPyZ_kbZW3lcGs_LC1zklREAo/view

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    Thank you - I see the issue now.

    The problem is being caused by the fact that when the Salary column is empty it is set to null in the database. This is reflected in the JSON that is loaded from the server. However, null cannot be represented in a input element, so Editor transforms that null into an empty string - thus the value is different and it submits the data from that row.

    This thread has discussion on how Editor can better handle null values on the client-side. I'm afraid that at the moment there is no workaround for this.

    Allan

This discussion has been closed.