I have a table with names of people, for example:
Nombre
-------
Juan
Juan Antonio
Juana
When I want to search for Juan in the search field, DataTable shows me all three, because it does a search on those fields that CONTAIN the searched word.
I want to know how I can configure the DataTable so that it returns the results equal to the indicated word.
Example of what I don't want:
I have (Juan, Juan Antonio, Juana, Juanete, Juanito) and I look for (Juan) and it returns (Juan, Juan Antonio, Juana, Juanete, Juanito) .
What I want:
I have (Juan, Juan Antonio, Juana, Juanete, Juanito) and I look for (Juan) and it returns (Juan) .
I have (Juan, Juan Antonio, Juana, Juanete, Juanito) and I look for (Ju) and it returns () . because there is no name Ju
According to what I have read, you can create a custom filter for it, I don't know if datable has any configuration parameter for this aspect. I enclose this code, which may be of use to you.
The first thing is to define the variable that contains the table:
And with the following function you could do the exact match filter. The identifier used corresponds to the input where you type the value to search for.
I pass you the source where you can have more clarity of the function in question and there is an application example.
Source: https://code-examples.net/es/q/219389e