Search - tweaking?
Search - tweaking?
The search seems to default to "or" - example - If I enter:
Fred 22
I see all records with Fred or 22.
But what I want to see is Fred AND 22. However the search is pretty literal - if I try and use quoted, or an AND or any other operator, it searches for that text.
Is there a way so the search defaults to an exact match, so if I enter Fred 22, only a record that actually has "Fred 22" displays?
Thanks
Rick
PS - FANTASTIC product!
Fred 22
I see all records with Fred or 22.
But what I want to see is Fred AND 22. However the search is pretty literal - if I try and use quoted, or an AND or any other operator, it searches for that text.
Is there a way so the search defaults to an exact match, so if I enter Fred 22, only a record that actually has "Fred 22" displays?
Thanks
Rick
PS - FANTASTIC product!
This discussion has been closed.
Replies
The search should be operating as an AND search - is it possible that the '22' is being picked up somewhere else in the row (in the HTML, or as part of a larger string or something like that). If you search for "2.0 1.8" in my demo table ( http://datatables.net/ ) then you should see the AND operation in action.
To tweak the search, what you can do is to unbind the event handler that DataTables puts onto the search box and then attach your own (which calls fnFilter), making use of regular expressions if you wish.
Regards,
Allan
How can I do this smart search (search "2.0 1.8") from your demo table, in server-side datatables?
Thanks!
However - you will need to concatenate all of the columns in your DB for that to be effective. And regex can be quite slow on some databases... long and short - it's not easy to do (but it is possible).
Allan