Trying to only display exact matches to the search term entered in the search bar.
For instance, I have a search bar that filters by ID#. I want only records that match the exact # entered to display.
So if 123
is entered, I don't want 12345
, 91239
, etc etc to be displayed. Only 123
.
Saw some info about bRegex
on the FAQ page, but it's not working for me. Any ideas?
This will give you exact result for a column.
table.column(i) .search("^" + $(this).val() + "$", true, false, true) .draw();
ie . search( input , regex, smart , caseInsen )
Ok solved the problem. However, since the column I am using the exact match on sometimes contains multiple ID #s seperated by commas, I wont be able to use an exact match search.
But for those interested, here is the answer:
oTable.fnFilter( "^"+TERM+"$", COLUMN , true); //Term, Column #, RegExp Filter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With