'postEdit' event callback parameters

'postEdit' event callback parameters

timothy.ctr.searcy@faa.govtimothy.ctr.searcy@faa.gov Posts: 6Questions: 4Answers: 0

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

  • allanallan Posts: 51,411Questions: 1Answers: 7,752 Site admin

    According to documentation, I was thinking the "data" parameter would be having the preSubmit values

    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

  • allanallan Posts: 51,411Questions: 1Answers: 7,752 Site admin
    Answer ✓

    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 the json.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

  • timothy.ctr.searcy@faa.govtimothy.ctr.searcy@faa.gov Posts: 6Questions: 4Answers: 0

    Thanks Allan.

    So if I need the pre-submit data at postEdit event, I need to store it in Javascript object before submitting?

  • colincolin Posts: 8,013Questions: 0Answers: 1,348
    Answer ✓

    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

Sign In or Register to comment.