0
  • I have a jQuery dataTable which I use to search for a month like this:
    table.column(1).search("February").draw();
  • I would like to pass 2 months as filter now but this does not work:
    table.column(1).search(["Ferbrary", "March"]).draw();

Is there anyway we can add 2 DataTables.API objects and invoke a draw() on the combination? I tried this and it didn't work:

    filtered_table = table.column(1).search("February") + table.column(1).search("March");
    filtered_table.draw();

As per the suggestion in the above link, I tried these and none worked:

    table.fnFilter("^February\$|^March\$", 1, true, false, false, false).draw();
    table.fnFilter("February|March", 1, true, false, false, false).draw();

How do I achieve multiple value filters on the same column? Pls help!

1 Answer 1

0

You can use regular expressions with column().search() API method to search for multiple values in the same column.

For example:

table.column(1).search('February|March', true, false).draw();

See this example for code and demonstration.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.