Getting selected row data from multiple tables

Getting selected row data from multiple tables

pr4wpr4w Posts: 1Questions: 1Answers: 0

Hi,

I'm struggling to find a way to get the data from multiple tables at all at once using .rows().

Essentially I have X number of tables on a page, and users need to be able to select items from multiple tables, but I can't seem to get it to work.

Here is my code so far:

`$(document).ready(function() {

    tables = $('table.table').DataTable({
        dom: 'lBrtip',
        columnDefs: [ {
            orderable: false,
            className: 'select-checkbox',
            targets:   0
        }],
        buttons: [
            'selectAll',
            'selectNone'
        ],
        select: {
            style:    'multi+shift',
            selector: 'td:first-child'
        },
        order: [
            [1, '$order']
        ],
        lengthChange: false
    });

    $(document).click(function() {

        rowData = tables.rows( { selected: true } ).data().pluck(1).toArray();
        console.log(rowData);

    });

});`

The issue is that the output in the log is the entire _Api. I've spent hours looking online and trying all sorts of different methods but I can't figure out how to get this to work?

Any thoughts?

Thanks!
Mark

Answers

This discussion has been closed.