WestCoast_BC
asked on
how to clear selections in datatable
I am using datatables (https://datatables.net/). My tables contain a column with checkboxes. I get which rows are checked by doing the following:
var tu = $('#mytable').dataTable().api();
var rows_selected = tu.column(0).checkboxes.selected();
This works fine until I recreate the table with new data. When I execute the code above I am getting the selected rows from the initial data. I have tried calling destroy() and clear() before I call datatable() again. Ie, I have tried doing:
$('#mytable').DataTable().clear().destroy().draw();
I am recreating the table by doing the following:
$("#contactlist").html(data);
where data contains the html for the table (ie <table><thead> ....</thead><tbody>....</tbody></table>)
Can anyone help me figure out what I need to do to clear the previously selected rows.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER