Datatables and checkbox behavior for filtering

Datatables and checkbox behavior for filtering

Noodles12Noodles12 Posts: 107Questions: 38Answers: 2

I am using datatables to filter values (using check boxes and drop-down menus). The "Name" filter column is a checkbox, while the Position and Office columns are drop-down menus. My system works fine, but I am experiencing the following issue.

When I select Name - Ashton it hides Garett and ID AI.

Expected Behavior: When I select Ashton, it should not hide Garett and ID AI. The user should be able to change their mind and select Garett or AD AI. But the user should be able to select only one checkbox at a time.(kindof like radio button). How can I achieve this. Thanks

Here is the link to the fiddle and code - https://jsfiddle.net/9a4wfszk/1/

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Looks like you will want to remove column 0 from the columns().every() loop in the buildCheckboxes function. This is updating the checkboxes based on the remaining rows shown in the table. Just build the checkboxes once inside initComplete. I think I posted an example yesterday for you.

    table.columns([0, 1, 2]).every(function() {
    

    Kevin

  • Noodles12Noodles12 Posts: 107Questions: 38Answers: 2

    Thankyou. I decided to keep dropdowns instead of checkbox. Sprry for going back and forth. We are still trying to figure out the best approach.

Sign In or Register to comment.