Check box filtering

Check box filtering

jjbcodejjbcode 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

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954

    See if this example helps:
    https://live.datatables.net/vipifute/1/edit

    Kevin

  • jjbcodejjbcode Posts: 12Questions: 3Answers: 0

    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

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954

    Just add some logic to decide whether to search for boolean true or false. I modified the original example to demonstrate:
    https://live.datatables.net/hijicuqa/1/edit

    Kevin

  • jjbcodejjbcode Posts: 12Questions: 3Answers: 0
    edited June 2023

    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

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954

    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

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954

    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

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954
    Answer ✓

    Another option is to use columns.visible to hide two new columns. One for rush and one for stamp. Then point the appropriate column search to the index of the hidden columns.

    Kevin

  • jjbcodejjbcode Posts: 12Questions: 3Answers: 0

    Hi Kevin,

     Thanks so much for taking the time to help. I will go over these answers and see if I can get this going. Thanks again. All the best
    
  • jjbcodejjbcode Posts: 12Questions: 3Answers: 0
    edited June 2023

    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.

Sign In or Register to comment.