Filtering Suggestions...

Filtering Suggestions...

pgrajupgraju Posts: 2Questions: 0Answers: 0
edited September 2009 in General
Hi all,

Firstly, Allan thanks on such a great plugin for jquery it has literally been a lifesaver!

Secondly, my question :)

I'm trying to work out the best way to approach a problem I'm currently having with filtering. At the moment I have a column called "Status", there are only two options under this column "Active" and "Not Active". The problem occurs when a User filters on only Active records, Not Active records are also being displayed as they both contain the word Active :S.

So I'm wondering what would be the best approach to enable the filtering to be more strict or even so create a checkbox which will "Show Active Only" when clicked and when unchecked "Show All".

Any ideas or suggestions?

Thanks!

Replies

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Hi pgraju,

    Are you using fnFilter() ( http://datatables.net/api#fnFilter ) on a specific column? If so, then you can just use a regular expression by passing the third parameter to fnFilter as 'false' to disable regexp character escaping by DataTables. Then you will be able to do filters such as "^Active$" or "^Not Active$" - which will be absolute.

    If you are using global filtering (ie. not on a single column) then it's a bit harder - but we will cross the bridge when we come to it.

    Regards,
    Allan
This discussion has been closed.