I am using jQuery DataTables and I would like to know how I can filter OUT rows of my table to show and hide them depending on the state of a checkbox. If my 'Hide' checkbox is checked then hide rows where class=var and if checkbox is not checked show rows where class=var
I have setup a small demo with the ability to hide/remove the rows I want but this doesn't allow the rows to reappear.
http://jsfiddle.net/bcraig/cY8Cn/2/
$('#stock').DataTable({
"sDom": '',
"infoEmpty": "No entries to show",
"aaSorting": [ ],
"aoColumnDefs": [{ "bSortable": false, "aTargets": [ 0 ]}],
});
var oTable = $('#stock').DataTable();
$('#hide').click(function() {
if ($(this).is(':checked')) {
oTable.row('.takenstock, .takensold').remove().draw(true);
$('label').text("Show taken");
} else {
oTable.draw();
$('label').text("Hide taken");
}
});