How to manipulate server response for editor when update record
How to manipulate server response for editor when update record

Error messages shown: A system error has occurred
Description of problem:
I am trying to make the GRUD work for the Editor. The server that I am working with only response with status code 200/201 with out any data. So Whenever I click on update, the record is updated on the server, but on the editor will display "A system error has occurred".
I tried to use editor
.on( 'postSubmit', function( e, json, data, action ) { }) to update json varaible, since server response no data, the json is simple null value and editor will go into error state. And according the manual, https://editor.datatables.net/reference/event/postSubmit, I need to
"If you want to manipulate this error response into a successful response, you need to use a custom complete function on the ajax object that will mutate the responseJSON/responseText (depending on your version of jQuery) parameters of the XHR object to contain valid JSON."
I am just not sure how to modify that responseJSON, so editor able to pick that up.
What I am after is trick the editor to think the update is succeed, and do a reload. Anyone done something like that before? and how to that?
thank you
Answers
should do it.
You may wish to call
ajax.reload()
as well, but depending on your setup it might not be required.Allan
thank you so much, saved me a lot of time.