Getting row data after edit

Getting row data after edit

csyucsyu Posts: 21Questions: 4Answers: 1
edited July 2022 in Editor

Hello,

Description of the problem
I'm able to edit my table without issue. However, after I edit a cell, I am looking get other cell data from the row where the edit was made. To do so, I wrote the following code without success.

Here is my code:

editor.on('edit', function(e, json, data, id) {
console.log("Row id: " + id);
var row = table.row(id).data();
console.log(row);
var versionNo = $.fn.dataTable.version;
console.log("Datatable version: " + versionNo);
});

Debugger console
Row id: id_1962
undefined
Datatable version: 1.12.1

Any help would be much appreciated.

Thanks

Replies

  • kthorngrenkthorngren Posts: 21,449Questions: 26Answers: 4,975

    I think you will want to use the row-selector as shown in this String - #ID selector example. For example:

    table.row( "#" + id ).data();
    

    Kevin

  • csyucsyu Posts: 21Questions: 4Answers: 1

    Thank you very much Kevin. That worked.

Sign In or Register to comment.