How to search with checkbox filter
How to search with checkbox filter
amosangyj
Posts: 5Questions: 2Answers: 0
Hello,
I have inserted a row of checkboxes below my search to filter by document types and want to trigger them via onclick. I have tried searching around to see if anyone else has done similar items but I couldn't find any so far. May I know if its possible to integrate it?
My checkbox filter is called filter and I'm unsure of how to integrate it to the onclick when I search. Hope someone can help.
$('#searchButton').on('click',function(e){
table.search($("#table_filter input").val()).draw();
console.log(filter);
});
$('#table_filter input').on('keydown',function(e){
if(e.which == 13){
table.search($("#table_filter input").val()).draw();
}
});
This discussion has been closed.
Answers
Hi @amosangyj ,
This thread on StackOverflow may be what you're after - look at the mainguy's response, and the link he gave for a running demo.
Cheers,
Colin
This here, may also help: https://datatables.net/blog/2017-11-30
Not checkboxes, but could be a similar interface that would work for you.
C
Hi Colin, I saw that and it didn't really work for me. I actually did it a different way. I created a div which I used javascript to force it below my search box and then built a short script to detect what was checked and pushed or removed that into an array. Then I built a getter to get the current details of the array and posted that along with my datatable post. I think this worked out pretty well for me.
Thanks for helping though!