This example demonstrates how to hide/show DataTable rows based on selection criteria. The problem is when a table is sorted, or paged the status (row hidden/shown) is lossed. With this script hidden rows are 'saved' throughout the session, enabling paging* and sorting. Selections are made based on class names. e.g. all rows with class name "goggles" are removed when checkbox with id "goggles" gets unchecked. Class names are attached by a function that grabs input from the dataset /cell (check RowClassFormatter in the source).
Class name overlapping is supported. When a box is rechecked (show), it only shows those rows not hidden by another selection (e.g. winter) that could be in unselected (hidden) state.
Easy integration:
<input type="checkbox" value="1" checked id="summer" onclick="updateResults(this)"/><label for="summer">Summer</label>
will enable all "summer" classes to be removed (based on a 'hidden' column named 'grouped' in our dataset).
If you dont want to hide the row, you can also only change it's stylesheet.
up next: a custom pager will correctly enable paging. difficult since the pager counts records hidden.