i have alternative words and i want the search know alternatives
i have alternative words and i want the search know alternatives
ASHKARdatatables
Posts: 18Questions: 5Answers: 0
hi every one ,
i face a problem, that there is alternatives words such as : united states = usa = america = united states of america , hematology = cbc
so when the user try to search for cbc the message show : No matching records found
if the user search for (united states) or (usa) or (america) or (united states of america) , the united states rows will show
the code :
This question has an accepted answers - jump to answer
Answers
One option might be to use Orthogonal data. In the
columns.render
function forfilter
look up the column data to get a space separated list of alternatives. For example:http://jsfiddle.net/o6a0zyrk/
Kevin
Thinking about it my example won't work correctly. For example if you type "states" it will match the United States cells. Let me think about it or maybe someone else will respond with a better solution.
Kevin
Individual column filters, with select inputs:
https://datatables.net/examples/api/multi_filter_select.html
Otherwise this is beyond the scope of DataTables.
it worked fine Kevin, thanks
just make some changes , i added the same word again in alternatives
ex : 'Hematology': 'Hematology cbc',
'United States': 'usa america united states of america',
and i changed the target to be targets: '_all',
this is the code
https://jsfiddle.net/BakBaka7a/zcx2eLdo/5/
Good glad it works for you. Using
targets: '_all'
is a good choice.Kevin
I wonder if the fuzzy search might be of interest as well. It won't help with something was different as USA and "United States of America", but it will help for closer words.
Allan
hi Allan,
unfortionitly, not even closer words