Search: filter only the field which start by the searched expression
Search: filter only the field which start by the searched expression
Hi,
By using the global input search box (on top right of the table), I would like to display only the row where the field of the first column start by the searched expression.
For example I have these data in my table (where | is the column separator):
arnaud | manager
sarah | employee
archie | arranger
actually when I enter "ar" in the input search area, all rows are displayed, but only the rows 1 and 3 have "ar" at the beginning of the word. If I search "arn" only the first row should be displayed.
Hope you understand me...
Please could you help me?
Best regards
This discussion has been closed.
Answers
You would need to use a regex
search()for that, something likesearch('^arn', true, false)- see examples here.This thread shows you how to reuse the existing search box for your own purposes.
Colin
Thanks a lot for this response. I've try it but each request hide all lines, so I've disable option "searching" in dataTable and script my personnal code:
Now It's OK
Have a nice day
Arnaud