KeyTable inline editing + submit on blur

KeyTable inline editing + submit on blur

ruggggerrugggger Posts: 23Questions: 6Answers: 1

I have a table which I navigate on using keyTable with inline editing.

 editor = new $.fn.dataTable.Editor({
        formOptions: {
            inline: {
               submit: 'allIfChanged'
            }
        },
    ...
    ...
   let table = $('#datatable').DataTable({
       ...
        keys: {
            editor: editor,
          //  editOnFocus: true
        },

When I activate the 'editOnFocus' option then I enter into inline editing on each cell, but when I blur out, it submits only on the first cell.
When I turn the option off, it will submit on each blur. (but I don't get the inline editing on focus, which I want).

I'm not sure if it's a bug or a bad configuration.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,177Questions: 1Answers: 2,590

    I just tried it here, and it seems to be behaving as expected - the submits happen on all columns, not just the first. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • ruggggerrugggger Posts: 23Questions: 6Answers: 1

    Thanks for answering. Indeed it works well on your example. I am going to check and compare..

  • ruggggerrugggger Posts: 23Questions: 6Answers: 1
    edited August 2020

    The only difference between my page and your example, is that I am using ajax to populate the data.

    //editor ajax settings -
    ajax: {
                url: TABLE_API,
                type: "POST",
                data: {
                    templateId
                }
            },
    
    
    // table ajax settings :
            ajax: {
                url: TABLE_API,
                type: "POST",
                "data": function (data) {
                    data['templateId'] = templateId
                }
            },
    

    When I remove the ajax part and use an already populated table it works.
    When I restore the ajax part then a POST request on submit is sent only for the first cell, for the next it doesn't.

  • rf1234rf1234 Posts: 2,809Questions: 85Answers: 406

    My use case is different but maybe it is worth a try adding an additional form option?!
    Like in here: https://datatables.net/forums/discussion/62123

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    The Ajax shouldn't make any different. What version of the software are you using? The debugger will be able to tell you.

    Beyond that, I think we'd need a link to your page to see and debug the issue, since it isn't reproducible in Colin's example.

    Thanks,
    Allan

  • ruggggerrugggger Posts: 23Questions: 6Answers: 1

    Sure. I'll send a link and password in a private message.
    Thank you !

This discussion has been closed.