3

I'm working with DataTables 1.10.11 and filtering the data by columns using the built-in fnFilter function.

In general, it's working fine, but when I try to filter a column using the regex option, it doesn't work.

For example:

var table = jQuery("#mytable").dataTable();

While this works just fine:

table.fnFilter("aaa", 0);

This doesn't work:

table.fnFilter("aaa|bbb", 0, true);

Am I missing something here? Do I have to set anything more than just the "true" option when setting the filter to work as regex?

This is the initial setup of the related code:

jQuery("#mytable").dataTable({
            "processing": true,
            "scrollCollapse": true,
            responsive: true,
            ordering: true,
            order: [1, 'desc'],
            bPaginate: false,
            fnInitComplete: function ()
            {
                // something happens here...
            }
        });

1 Answer 1

3

You need to specify the fourth parameter as false.

table.fnFilter("aaa|bbb", 0, true, false);
Sign up to request clarification or add additional context in comments.

1 Comment

As simple as that... :) I was aware of the boolean option for the regex thing, but wasn't aware of the additional boolean option... Thanks!!

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.