Filtering on checkbox
Filtering on checkbox
rfitzwater
Posts: 57Questions: 5Answers: 1
I have a column that is just checkboxes. I also have filtering on each column enabled. How can I filter the checkbox column to show only those that are checked?
Thanks,
-Rhon
Thanks,
-Rhon
This discussion has been closed.
Replies
[code]/* FILTER BASED ON CHECKED ITEMS */
//
$('#checkbox_filter').click( function() { oTable.fnDraw(); } );
/* Custom filtering function which will filter data in column four between two values */
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
if($('#starfilter').attr('checked')){
if($('input', oTable.fnGetNodes(iDataIndex)).is(':checked')){
return true
}
}
else {
return true
}
}
);
//
/* END OF CHECKED FILTER */
[/code]
In my footer, the checkbox column, I put a checkbox with an id of checkbox_filter. When that checkbox is clicked, the code above runs.