Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81922

Duplicate button for multiple selected rows is only updating rows

$
0
0

https://editor.datatables.net/examples/api/duplicateButton.html

using the example, I added the button to duplicate selected rows.

action: function(event, datatable, node, config) {
    editor.edit(
        datatable.rows({selected: true}).indexes(),
        {
            title: 'Copy record',
            buttons: 'Create from existing'
        }
    ).mode('create');
},

ajax options for editor:

edit: {
    type: 'PUT',
    url: '/api/hifCableRequestRow',
    data: function (data) {
        return JSON.stringify(data.data);
    },
    "contentType": "application/json"
},
remove: {
    type: 'DELETE',
    url: '/api/hifCableRequestRow',
    data: function (data) {
        var crfkeys = [];
        for (var crf in data.data) {
            crfkeys.push(crf);
        }
        return {'crfkeys': crfkeys};
    }
},
create: {
    type: 'POST',
    url: '/api/hifCableRequestRow',
    data: function (data) {
        return JSON.stringify(data.data);
    },
    "contentType": "application/json"
}

request

{123123: {...}, 123124: {...}, ...}

If I select multiple rows, and click the new copy button, it sends a PUT request instead of a POST request. Any thoughts on what I might be doing wrong? Perhaps this is intended and I just need to make my server handle that payload as a create? How can I distinguish the requests?


Viewing all articles
Browse latest Browse all 81922

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>