I have the following table:
<table id='t'>
<thead><tr><th>First Name</th><th>Last Name</th></tr></thead>
<tbody></tbody>
</table>
with the following JS:
var data = [{id:1, vals:['John','Doe']},{id:2,vals:['Peter', 'Len']}],
$table=$('#t'),
editor=new $.fn.dataTable.Editor({
table:$table,
fields: [
{
label:'First Name',
name:'col-0',
data: function (row, type, set) {
if (type == 'set')
row.vals[0] = set;
else
return row.vals[0];
}
},
{
label:'Last Name',
name:'col-1',
data: function (row, type, set) {
if (type == 'set')
row.vals[1] = set;
else
return row.vals[1];
}
}
],
idSrc:'id',
formOptions: {inline: {onBlur: 'submit',}}
}),
dataTable=$table.DataTable({
columns:[
{data:'vals.0', editField: 'col-0'},
{data:'vals.1', editField: 'col-1'}
],
data:data
});
$table.on('click', 'tbody td', function () {
editor.inline(this);
});
Going into edit mode works fine, but when submitting the change, it simply reverts back to the old value. Why is this?