Hello,
I've been trying to implement inline editing to our datatables (using the trial, to try it out).
The client sided version is ready, but we want to do the server sided handling ourselves.
However, I'm very confused on how to send the data back to the client.
This is my current code:
var editor = new $.fn.dataTable.Editor(
{
ajax: '/api.php',
table: '#table',
fields: [
{
'name': 'column1',
'label': 'Column 1'
},
{
'name': 'column2',
'label': 'Column 2'
}
],
idSrc: 'ID'
}
);
$('#table').on('click', 'tbody td:not(:first-child)', function(e) {
try {
editor.inline( this, {
submitOnBlur: true,
submit: 'changed'
} );
} catch(e) {
console.log(e);
}
});
It sends the data fine and we're able to read it, work with it and stuff. But then I send the data back like this:
{
"data": {
DT_RowId: 99,
ID: 99,
column1: 'value',
column2: 'value'
}
}
after I send this data, the row just disappears on me in the DataTables (Not in the data). When I refresh the page the data returns to me like normal.
I'm not sure what DT_RowId is, I've been looking in the documentation on how the client should receive the data, and they all showed DT_RowId even though the javascript didn't show any DT_RowId column, so I thought it was needed. but it doesn't do anything for me.