datatables inline editing submitted data

datatables inline editing submitted data

TomTom80mTomTom80m Posts: 2Questions: 1Answers: 0

hello

i'm using the datatables inline editing plug-in which works basicly fine...

$('#testTable').on( 'change', 'input.editor-active', function () {
editor2
.edit( $(this).closest('tr'), false )
.submit();
} );

the request after editing looks like this: url/action=edit&data.20001.id=20001&data.20001.name=test

how can i change the url/submitted date to url/action=edit&id=20001&name=test ??

i did not find any configuration for this... can anyone help me?

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

  • TomTom80mTomTom80m Posts: 2Questions: 1Answers: 0

    no sorry...did not fix my problem...

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    Just to confirm - you want to change the name of the parameters that are being submitted? You can do so using the preSubmit event. For example:

    editor.on( 'preSubmit', function ( e, data, action ) {
      $.each( data.data, function ( key, values ) {
        data.id = key;
        $.extend( true, data, data.data[key] );
        delete data.data;
      } );
    } );
    

    Obviously the disadvantage of this method is that you can't use Editor's multi-row editing ability, nor can you call your parameters action or id. You also can't use our pre-built libraries for PHP, NodeJS or .NET.

    For more information about the client / server communication that Editor uses please see the docs here.

    Allan

This discussion has been closed.