How can I filter a column based on a checkbox?
How can I filter a column based on a checkbox?
Here's the basic setup of my table:
listTable = $('#bandit_list_table').DataTable({
pageLength: PAGE_LENGTH,
processing: true,
serverSide: true,
ajax: {
'url': '/a/multi_armed_bandit/get_trials_json?soid=' + self.model.get('store_id'),
'type': 'POST'
},
// ajaxSource: '/a/multi_armed_bandit/get_trials_json?soid=' + self.model.get('store_id'),
order: [[TRIAL_ID_COLUMN, 'desc']],
language: {
search: '
',
lengthMenu: '
',
loadingRecords: 'Loading Bandit Trials. Please wait...',
paginate: {
first: '<i class="fa fa-angle-double-left wfa_table_pagination">',
previous: '<i class="fa fa-angle-left wfa_table_pagination">',
next: '<i class="fa fa-angle-right wfa_table_pagination">',
last: '<i class="fa fa-angle-double-right wfa_table_pagination">'
}
},
pagingType: 'full_numbers',
Here's my search function:
var getActiveOnly = e.target.checked;
listTable.columns(8).search(getActiveOnly).draw();
I can listen for the checkbox to be checked with no problems and I can get my PHP endpoint to return the data I want, but it's not updating my Datatable.