DataTables Search Filter Exact Match
DataTables Search Filter Exact Match
KeiSenpai
Posts: 21Questions: 8Answers: 0
Hello All,
I am new to DataTables and wondering is it possible to make the search box filter for exact match only?
I know at the moment if I have a list of numbers, and type '1', it will pull back anything containing '1'.
I appreciate it.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You will want to use regex searching. See this example. Your search string, for the
1
example you gave, will need to be^1$
. The use can type^1$
or you can create a custom input where the user types1
and you insert the value between^
and$
, for exampletable.search( '^' + $('#myInput').val() + '$' ).draw();
.Kevin