When I use a checkbox I want to be able to search for checked
When I use a checkbox I want to be able to search for checked

Link to test case: https://jsfiddle.net/ben_davies/tfrh4m6e/1/
Debugger code (debug.datatables.net):
Error messages shown: None
Description of problem: So I have a search row at the top of the table and say you want to only get checked values you would type checked in the boolean column search box but nothing shows; In my implementation I have a select2 dropdown to choose from checked or unchecked but in this example if you type checked nothing shows i have tried to add a data attribute so the data contains the word checked from my assumption search looking for text matching what you have written
This question has an accepted answers - jump to answer
Answers
Your checkbox looks like this:
<input type='checkbox' data-valset='unchecked'>
Are you expecting to search for the value in
data-valset
?You are using
that.search(val).draw();
. This uses smart search meaning the searching forchecked
will also result in displaying rows with the valueunchecked
I would look at using a type based search plugin to modify the the checkbox data to something you can search.
I built a simple example that you can start from:
https://jsfiddle.net/1bc30gd4/
Assuming you are wanting to use
valset
I changedvalset
to usen
for unchecked andy
for checked. You can change these appropriately. Note this also affects sorting. Note this will require that you keep up withvalset
and change it appropriately. You might also need to usecell().invalidate()
when updatingvalset
.Kevin