InitEdit is called after refresh datatable

InitEdit is called after refresh datatable

GoinsideGoinside Posts: 11Questions: 3Answers: 0

I have a databales v1.13.4 with editor 2.0.5 to edit inline. I want the submit only on exit cell or enter key pressed. So, I click at a cell, change the cell value, press tab key to go to next cell and so on. Finally, when press the enter key, the submit to server occurs and the edition ends. The problem is that if I refresh datatable (table.ajax.reload()), it call "initEdit" event and the last cell edited, have now the focus and it is in edition. I tried call "editor.close()" at several events like "presubmit", "submitComplete", "enterKeyPressed" and it not works. Can you help me?

formOptions: {
    inline: {
        drawType: "none",
        submit: "allIfChanged"
    }
}

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    So, I click at a cell, change the cell value, press tab key to go to next cell and so on. Finally, when press the enter key, the submit to server occurs and the edition ends.

    For this you would need to use a queuing method like that described in this blog post. Is that something that you are doing?

    Each inline edit is a septate action for the cell being edited (unless you were to inline edit multiple cells at a time), hence the need for a second instance, would would resolve your issue.

    Allan

  • GoinsideGoinside Posts: 11Questions: 3Answers: 0

    After several changes in the code, I still cannot exit the edition mode. Now, if I submit the edition (ex: editor.submit()), the cell continuos in edition mode. I tried call "editor.close()" but with no success. Thanks.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    If you could give me a link to the page showing the issue, I'd be happy to have a look at it. My guess is that the JSON from the server is returning an error message, which for some reason isn't being displayed.

    Allan

  • GoinsideGoinside Posts: 11Questions: 3Answers: 0

    In my case, the error was caused by datatable().row().select() insite the "initEdit" event. Removing that, the editor is closed (no cell in edition mode) after refresh datatables. Thanks for you support.

Sign In or Register to comment.