Single Save for multiple rows

Single Save for multiple rows

emily16emily16 Posts: 2Questions: 3Answers: 0

Currently I have a save button for each row of the Datatable but I want to add the feature where any number of rows can be selected and saved on a single click of a Save button.
Here is my code - https://jsfiddle.net/w6vytssh/2/
Right now I have multiselect enabled using var table = $('#orderTable').DataTable( {
select: {
style: 'multi'
},
But I'm really confused about enabling single save.
I used the below mentioned method earlier to enable multiselect and save but it did not work and threw this error I get this error - (index):531 Uncaught TypeError: row[18].find is not a function -

I use this code to enable multi-row select -

$('#orderTable tbody').on( 'click', 'tr', function () {
            $(this).toggleClass('selected');
            var pos = table.row(this).index();
            var row = table.row(pos).data();
            console.log(row);
        } );

And this to loop over the array of selected rows and perform certain operations.

$(document).on('click','#btnAll', function(){

            var oAll =[];
            $('#orderTable tbody tr.selected').each(function(){
                var pos = table.row(this).index();
                var row = table.row(pos).data();
                oAll.push(row);


var rejectReasons = { PersistRejectReasons :[] }
    var jsonReturnObj = new Object();

jsonReturnObj.OrderNumber = row[0];
jsonReturnObj.OrderLineNumber = row[1];
 jsonReturnObj.RejectReasonCode 
    =row[18].find(“option:selected”).prop(“value”);

-------------------------(Code continues)

How can I achieve this?

This discussion has been closed.