'postEdit' event callback parameters
'postEdit' event callback parameters
Hi,
I am using 'postEdit' event callback like below:
editor.on( 'postEdit', function ( e, json, data) {
console.table(json);
console.table(data);
});
In my console, the values for "json" and "data" are same, i.e., those that are returned from server after a row edit. According to documentation, I was thinking the "data" parameter would be having the preSubmit values. Am I missing anything? I am using Editor 1.7
Thanks.
This question has accepted answers - jump to:
Answers
That should be the case. If you were to do
json === data
they should be different objects, since the JSON is whatever the serve returns.One good way to see a difference between them is to use inline editing which, by default, will only submit the changed value, so
data
will appear "incomplete" (in terms of the whole data row).Allan
Apologies - Colin has just questioned me about this one and my answer above is wrong!
The
data
property is exactly the same as the content in thejson.data
array, for that row. Its effectively just a short cut to the row's data - which can be useful for when multi-row editing is used.Allan
Thanks Allan.
So if I need the pre-submit data at postEdit event, I need to store it in Javascript object before submitting?
Hi @timothy.ctr.searcy@faa.gov ,
Yep, that would be the way to go. The DataTables API has a method to get the data sent to the server,
ajax.params()
, but sadly there isn't an equivalent method for Editor.Cheers,
Colin