Using .search(this.value, false, false) is matching multiple
Using .search(this.value, false, false) is matching multiple
KeiSenpai
Posts: 21Questions: 8Answers: 0
I am reading a JSON file into my DataTables. I have a dropdown filter that filters column 1, but it is not doing an exact match and pulling say '123' & '1234' when I only want '123' back.
$('#commodityFilter').on('change', function () {
if (this.value === 'ABC & ABCD') {
tableAll.columns(1).search("ABC|ABCD", true, false).draw();
} else {
tableAll.columns(1).search(this.value, false, false).draw();
}
} );
I ensured that smart & regex is off. Am I missing something? I even tried providing regex for exact match.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If you want to search for
123
specifically and ignore rows with1234
then you will need a regex search. There are various regex operators you can use. One option is to perform a regex search like this:If
123
is entered the search would look like this:You can experiment with this example.
Kevin