Skip to content Skip to sidebar Skip to footer

DataTable - Easy Way To Get All Selected Rows In JQuery

How I can get all selected rows from the jQuery DataTable (https://datatables.net). Here in stackoverflow found ways to count the selected rows, but I need the selected row data t

Solution 1:

You can iterate over the row data

$('#button').click(function () {
    var ids = $.map(table.rows('.selected').data(), function (item) {
        return item[0]
    });
    console.log(ids)
    alert(table.rows('.selected').data().length + ' row(s) selected');
});

Demo:Demo Example


Post a Comment for "DataTable - Easy Way To Get All Selected Rows In JQuery"