DataTables Editor > getting back the EDITED data after inline editing the row's data

DataTables Editor > getting back the EDITED data after inline editing the row's data

trendsictrendsic Posts: 7Questions: 2Answers: 1

I'm having trouble getting back the EDITED inline edited row data. Using table.row(this).data() inside a editor.on('edit') callback I can get back the previous row data, but I need it for the row data that was just edited.

note: "table" and "editor" are using the API method set to the table and editor jQuery selectors

Answers

  • rf1234rf1234 Posts: 2,939Questions: 87Answers: 415

    You can use postSubmit
    https://editor.datatables.net/reference/event/postSubmit
    but that will also be triggered if the editing was unsuccessful

    or you use submitSuccess
    https://editor.datatables.net/reference/event/submitSuccess
    which gives you the benefit that you don't have to deal with unsuccessful submissions.

  • trendsictrendsic Posts: 7Questions: 2Answers: 1
    edited August 2019

    @rf1234 that's a better callback than 'edit', so thanks for that, but I still don't see a way for me to get the row data out after it's been edited.

    Here's my current code:

    editor.on('submitSuccess', function (e) {
        console.log('Form edited');
    
        var a = table.row(this);
        var b = table.row(this).data();
        var c = table.cell(this).data();
        var d = e;
        debugger;
    });
    

    I've been unsuccessful finding an object with the edited data. Something like e.currentTarget.data or similar is what I was expecting, but everything I can find is dead ends.

  • trendsictrendsic Posts: 7Questions: 2Answers: 1

    I figured it out.

    editor.on('postEdit', function (e, json, data) {
        console.table(data);
    });
    
This discussion has been closed.