Search with multiples

Search with multiples

mitullermituller Posts: 1Questions: 1Answers: 0

I am trying to setup a table where I can filter by checkboxes and need some help. I have looked around, and found the fnFilter, which doesn't seem to be available anymore. And then found this thread. https://stackoverflow.com/questions/38232383/search-for-multiple-values-in-single-column-of-datatable-possibly-use-array

Where they pipe into search. I tried that, and I can only search by one item. So this works:
$('.display').DataTable().search('dhcp').draw();

But this doesn't:
$('.display').DataTable().search('dhcp'|'static').draw();

I would like to pass an array of items so that I can add and remove based on if the checkbox for the filter is checked or not. Any pointers as to how to go about this would be helpful.

Answers

  • allanallan Posts: 63,461Questions: 1Answers: 10,466 Site admin

    The search() docs show how you can enable it to do a regex search - for example:

    $('.display').DataTable().search('dhcp|static', true, false).draw();
    

    Allan

This discussion has been closed.