filter not working if text contains space
filter not working if text contains space
SriRishitha
Posts: 42Questions: 4Answers: 0
filter not working if text contains space like this (user name)
This discussion has been closed.
Replies
hello any one give me reply
for example when i type user n the filter is not working, when i type user na it is working properly.
http://jsfiddle.net/Lnvbnp6c/
i tries this sample also
when i type "system" the result is 3 rows,
when i type "system a" the result also 3 rows,
when i type "system ar" the result is 1 rows,
can any one tell me the solution
There are a couple of problems. Your custom search box isn't working at all. You have a couple errors to fix first:
In order to help with the regex search term please describe specifically what you want it to do.
Kevin
its sample i taken from net to show the problem in search.
**https://datatables.net/examples/api/regex.html ** in this also searching like that format only.
i am not using any custom search. i am using default filtering :true option
Your test case creates an additional input box with the ID of
search-inp
. This is the custom search box I'm referring to. This is the input your keyup event is attaching to.In the regex example when you search the Position column using Smart Search then you see the behavior you describe above. The
search()
docs describe Smart Searching and I think you are seeing the results of "Partial word matching". However if you turn of Smart Search and enable Regex then "system " will result in one row not three.If I understand your question correctly you need to change this line in your code:
table.columns(1).search(regex, true, false);
To this:
table.columns(2).search(term, true, false);
Your position column is in column 2 not 1. You can just search the
term
variable. Yourregex
value won't work unless you fully typesystem
andarchitect
.Kevin
i am not using the custom search.