2 Unique Filters on 1 Column

2 Unique Filters on 1 Column

sshefersshefer Posts: 5Questions: 0Answers: 0
edited August 2009 in General
I've been searching through the forum and API and I may be missing something but is there a way to call 2 unique filters on 1 column?

I'd like to give users the ability to live search a column but also filter out somethings based on a checkbox. I'm using fnFilter on the same column but when the search starts the results of the checkbox filter are immediately invalidated and the filter is refreshed.

Is there any way to mark these as unique filters on the same column? Thanks!

Replies

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin
    Hi sshefer,

    Yes indeed you can do this. Have you any experience with regular expressions? You can allow regular expressions on a column using the third parameter of fnFilter() - http://datatables.net/api#fnFilter . Then you can comdine your searches to be (for example) "first|second" (i.e. search for the string "first" or "second"). You can probably do 'AND" style searches as well.

    DataTables also presents a filtering plug-in mechanism, which might work very well for you. You can read about it here: http://datatables.net/development/filtering and there is an example here: http://datatables.net/examples/api/range_filtering.html

    Regards,
    Allan
  • sshefersshefer Posts: 5Questions: 0Answers: 0
    Thanks Allan!

    I've been digging into datatables over the past 2 days and I understand this work around. I was hoping I could avoid this as it would force me to check the checkbox status before every filter - but I've modified my search criteria to make this easier.

    Just wanted to say that this is by far the best and most comprehensive table plug-in I've found. You've created something absolutely amazing. Can't wait to see how this continues to develop.
This discussion has been closed.