I'm using jQuery Datatables plugin (v 1.10)
I am using the select feature and can highlight/select rows fine. I'm also using paging. I can page through the tables and select on multiple pages. I tried to create a button to clear selected rows, but it only clears rows selected on the current page.
Like this: $('#main_index1 tbody tr').removeClass('selected');
For example, if I have a row selected on page 1 and then go to page 2 of the table and run this function, the row selected on page 1 isn't deselected. If I selected something on page 2, that deselects just fine.
Any ideas how to deselect all selected rows across all pages?
Figured this out...tried this instead:
table = $("#main_index1").DataTable();
table
.rows( '.selected' )
.nodes()
.to$()
.removeClass( 'selected' );
Worked like a charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With