Upgrading from 1.10.15 to 1.10.18 breaks (multiple column) smart filtering?

Upgrading from 1.10.15 to 1.10.18 breaks (multiple column) smart filtering?

NullmannNullmann Posts: 4Questions: 1Answers: 0

Hey all,

when I wanted to upgrade from the above mentioned versions, it broke my "Search all columns"-function. I've both tried the search-API and the (apparently legacy) fnFilter with the same problem. When reverting back to the old version it works again. The code I am using is:

$(tableID).DataTable().search(searchValue).draw();
--- or ---
$(tableID).DataTable().search(searchValue, false, true).draw(); // Regex = false, Smart = true
--- or ---
$(tableID).dataTable().fnFilter(searchValue);

What I wanted to achieve is the same as this example when the user wants to search for "Airi Satou Accountant". In my local case, "Airi Satou " is found, but when searching for "Airi Satou A" there are no entries found anymore.

At this rate I am forced to downgrade to 1.10.15 again.

With best regards.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    In the example you linked to, if I run:

    $('#example').DataTable().search('Airi Satou A', false, true).draw();
    

    in the console, it shows a single row as expected.

    Can you describe what you did differently please?

    Allan

  • NullmannNullmann Posts: 4Questions: 1Answers: 0
    edited October 2018

    Yes, this is exactly the desired outcome, but for me it does not work with the version 1.10.18 of datatables anymore, only with version 1.10.15. To illustrate the problem, here are a few screenshots:

    Full table:

    Searching for "admin "

    Searching for "admin n"

    Edit: Thanks for your very fast reply!

  • NullmannNullmann Posts: 4Questions: 1Answers: 0
    edited October 2018

    Aaaaand I found the problem. When trying to fix the eslint-error
    There should be no space before ']' computed-property-spacing
    it caused the multi-line-searching to stop working, on both the old and new version.

    On closer look, it seems that this breaks the regex in function _fnFilterCreateSearch.

    For now I will just ignore these computed-property-spacing errors.

    Edit: I am unsure how to mark this as answered.

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    I'm not quite getting it. Is that a change in your code you need to make?

    Allan

  • NullmannNullmann Posts: 4Questions: 1Answers: 0

    During my workflow I minify all my js-files with grunt (not using your supplied minified version). The eslint-task throws a few errors, including the computed-property-spacing error among others (no trailing spaces, no tabs, no unsed vars, ...). For example, it wants [ variable ] to be [variable] without the spaces. When replacing ] with ] (without a space), it also changed some regular expressions in the source code, resulting in my problem.

    I will just ignore these errors for now and have marked your last post as the answer to my question so it does not show up as unanswered anymore.

    Thanks for your help and best regards!

This discussion has been closed.