how to search multiple values while using serverSide

how to search multiple values while using serverSide

hashsalacophashsalacop Posts: 19Questions: 5Answers: 0
edited July 2019 in Free community support

How can I search 01 and 03 in dropdown. while using serverSide

$('#firstsecond').on('change', function(){
         var dataCondition  = this.value; 
            if(dataCondition == 'firstsecond') {
              table.columns(136).search("01|03",true,false).draw();
      
            }else{
              table.columns(136).search(this.value).draw();
            }
    });

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @hashsalacop ,

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

  • hashsalacophashsalacop Posts: 19Questions: 5Answers: 0

    Hi, Colin, I think it's not the right answer. I want to use multiple values of
    Example in my column i have 1,2,3,4,5,6,5 different values. but i want to filter only 1 and 2 values in one dropdown. while im using serverside
    here is the code if were not using serverside

    ``` table.columns(136).search("01|03",true,false).draw();

  • kthorngrenkthorngren Posts: 21,152Questions: 26Answers: 4,919
    edited July 2019

    Are you asking for help with creating the drop down in the client or the regex search in your server script?

    If in the client then maybe you can provide a simple example of what you have. This way we can help with your code.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    If asking about the search in the server script, then as explained in the thread Colin posted, you will need to add that support to your server script. This depends on what you are using for your server script and the database or whatever is being accessed. Note this comment from the developer Allan:

    The main problem with it is that when you are dealing with enough records to warrant server-side processing, performance of regex becomes an issue.

    Kevin

This discussion has been closed.