Return only data modified

Return only data modified

mircoShapeMemircoShapeMe Posts: 4Questions: 1Answers: 0

Hi!

Is it possible to return, after the AJAX call for modifying a field, only the modified data, without returning the entire data line?
I have a very complex table and being able to return only the modified data would be a great relief.

Best Regards, Mirco.

This question has an accepted answers - jump to answer

Answers

  • mircoShapeMemircoShapeMe Posts: 4Questions: 1Answers: 0

    This is the same post
    https://datatables.net/forums/discussion/comment/103133

    Is there now a solution?

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    I assume that you are referring to Editor? Currently no - Editor expects the whole row of data to be returned, which allows for server-side generated values to update the client-side (last modified time for example).

    This is something that I'm going to look at relaxing in future though.

    Allan

  • mircoShapeMemircoShapeMe Posts: 4Questions: 1Answers: 0

    Ok, thank you for response.

    To get to the solution I'm trying to exploit the postSubmit event.

    But how can I manipulate the json returned from server?
    I've tried but with no success.

    Have you a code example? Thank you.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓
    editor.on( 'postSubmit', function ( e, json, data, action, xhr ) {
      var rowData = table.row( { selected: true } ).data();
    
      $.extend( true, json.data[0], rowData );
    } );
    

    This makes a number of assumptions:

    1. Only a single row is edited
    2. You are using the Select extension to select the row to edit

    It could be modified if you are using Editor / DataTables in some other way.

    Allan

  • mircoShapeMemircoShapeMe Posts: 4Questions: 1Answers: 0

    I found a workaround to answer my initial question.

    Thank you for response!

This discussion has been closed.