How to search for exact value in header search box
How to search for exact value in header search box
martin1223345
Posts: 84Questions: 23Answers: 0
live.datatables.net/mowobugu/1/edit
I cant figgur out how to search for the exact value in the added header search code in above example.. Is there a way to make datatables search for the exact result? Atm when searching Anneke, the result is also showing Janneke. It should only show Anneke.
Answers
Use regex searching. See this example. The select input example uses regex searching. Change your search to use regex similar to the select example.
Also you might want to use
orderCellsTop
to move the sorting events to the top row.Kevin
Thanks for reacting. I did found examples like yours. But I dont understand how to implent the regex into the example in my link.. Please help
See below example. It is just not working for me all the options I find. So please help how to make this work..
live.datatables.net/mowobugu/1/edit
When changing this.value to this.val it seems to work but than when empty it does nog reset..
Your first example has this error:
You have this:
Use
$(this).val()
instead of$(this).value()
. Here is the updated example:http://live.datatables.net/mowobugu/3/edit
Kevin
Thanks. I noticed that as i posted in my first comment. But when removing the results the table is not
refreshed to the original results. Any way to do this?
It just needs some logic to determine if there is a search string in place - see updated example here: http://live.datatables.net/mowobugu/4/edit
Colin