multiple search by using Comma (individual Column Search)

multiple search by using Comma (individual Column Search)

SandeepMuralaSandeepMurala Posts: 48Questions: 13Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Answers

  • SandeepMuralaSandeepMurala Posts: 48Questions: 13Answers: 0
    edited July 2021

    Hi every one ,
    I went through this https://datatables.net/extensions/fixedheader/examples/options/columnFiltering.html

    for Individual column search ,that is working fine .

    How can I search with (,)Comma with multiple values .
    For Instance In AGE column there is search option is there ,In that I can search with single value like 47 but how can I search with mutlipe values at time by using
    comma(,) like 47,41 I should get all 47 values and 41 values .Like this I need all the columns

    Please help on it .

    Thanks
    Sandeep

  • kthorngrenkthorngren Posts: 20,299Questions: 26Answers: 4,769

    You will need to use a regex expression. Instead of 47,41 you will need to use 47|41. Try this example. Type 47|41 in the Age column and turn on regex and turn off smart search. You should see all rows with either value.

    See the search() and ``-api column().search()docs for more details. If you want the users to use,instead of|you will need to add a regex replace() statement in the click event to replace all the,with|`. See the last example in this thread for an example.

    Kevin

  • SandeepMuralaSandeepMurala Posts: 48Questions: 13Answers: 0
    edited July 2021

    @kthorngren Thank you so much for your valuable response and time ,

    as expected it is showing but I got one more challege ,is it posible to search range wise like if I search 41|47 on individual AGE coulmn ,It should give AGE between 41 to 47 like 41,42,43,44,45,46,47 all this records need to display ,

    This is So appriciated and help on it please

    Thanks
    Sandeep

  • kthorngrenkthorngren Posts: 20,299Questions: 26Answers: 4,769

    This example shows how to do a range search.

    Kevin

Sign In or Register to comment.