When I submit the modified data to the server in onAfterEdit, if the submission fails, how can I cancel the modification of the current row? Even if I add the cancelEdit method to it, I can't get back to the original data. I can't use rejectChanges here because it will undo all the changes in the table.
Please help, thank you.
onAfterEdit:function(index,row,changes){
var inserted = $(this).datagrid('getChanges','inserted');
var updated = $(this).datagrid('getChanges','updated');
$.post('crud.php',{
type: (inserted.length > 0) ? 'add' : 'update',
row:row
},function(data){
if(data){
row.editing = false;
$('#test').datagrid('refreshRow', index);
}else{
$('#test').datagrid('cancelEdit', index);
$('#test').datagrid('beginEdit', index);
}
})
},