I want my user's column selections in Datatables to be retained with checkboxes. Datatables saveState does a great job with the table, but my external checkboxes are not in that function.
This image is the desired effect. ( Repeating Button text is unrelated.) These are Bootstrap checkboxes. I'd like when the user comes back and the table saved state is loaded, that the proper boxes are marked showing what other columns are available to show.
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
I started with this code above at Datatables, but I have no idea how to relate the boxes to the stateSave. It there a Datatables solution or am looking for a custom solution?