Getting selected row data from multiple tables
Getting selected row data from multiple tables
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
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
You will need to incorporate the
tables()API. Like this exmaple:http://live.datatables.net/wovotobu/1/edit
Kevin