Check box filtering
Check box filtering
jjbcode
Posts: 12Questions: 3Answers: 0
I am using the vue3 datatables. I am trying to filter with two check boxes at the top of the table, that if checked will filter the rows according to the matching data. I am using a boolen for the data. I searched but could not come up with what I am trying to do. any help is much appreciated. Thanks
This question has an accepted answers - jump to answer
Answers
See if this example helps:
https://live.datatables.net/vipifute/1/edit
Kevin
Hi I came across this type of example. How can I apply it to a boolean and not the text that is shown in the data table. I have these two data variables data:['rush','stamp'] and an Icon that shows up if they are true and hides when They are false. I want to be able to filter them by that boolean. Thanks
Just add some logic to decide whether to search for boolean
true
orfalse
. I modified the original example to demonstrate:https://live.datatables.net/hijicuqa/1/edit
Kevin
Hi, I kept trying it is not working for me. This is ow my columns array is setup.
{ className: "printIcon" , data:['rush','stamp']}
The two data variables are booleans. I want to display the row when I click the check box. In your example I could not figure it out. maybe I am missing something pretty obvious?
Thanks again for your help
If you have two values in the column then you will likely need to do something different. We will need to see exactly what you have to offer more specific suggestions. Please update my example or provide a test case with a sample of your data and how you are rendering the column so we can further help. Use the browser's network inspector to get a sampling of row data and use
columns.data
to add the rows to the table.Kevin
You might need a search plugin to search separate values in the column. Here is the plugin version of the first example I provided:
https://live.datatables.net/rosahuka/1153/edit
Kevin
Another option is to use
columns.visible
to hide two new columns. One forrush
and one forstamp
. Then point the appropriate column search to the index of the hidden columns.Kevin
Hi Kevin,
Hi Kevin, Thanks again for all of your time and help. I ended up using the option with the colunmns.visible it worked great, and was the easiest to implement.