DataTables() filters fine, except for a column that has a combo of letters/numbers (eg. OR 02)

DataTables() filters fine, except for a column that has a combo of letters/numbers (eg. OR 02)

rubetube56rubetube56 Posts: 5Questions: 1Answers: 0

For some reason, DataTables() seems to be filtering everything in my table fine except for one column where I post "OR Room". In this column, it is usually a combination of alpha/numeric....I am not sure if that might have anything to do w/ it? Help !!

This question has an accepted answers - jump to answer

Answers

  • rubetube56rubetube56 Posts: 5Questions: 1Answers: 0

    Is it possible that my strings are too short to be considered for sorting? In the column in question, the data will typically be 5 characters included a space (eg. OR 01 , OR 02, etc)

  • rubetube56rubetube56 Posts: 5Questions: 1Answers: 0

    Another update.....2 things:

    1. I have found that when I search for "OR 14" in double quotes, it will work properly and filter that column as I expect. Is this intended functionality to have to put strings in double quotes?

    2. When I do the steps to filter in 1. above, if I start out w/ a " , I immediately get JS script error: line 0 char0. But if I type OR 14" and then put the leading " before OR, afterwards....it works. Why???

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    It would be hugely helpful if you could link to your page or a test page showing the issue (as noted in the forum rules).

    It sounds like you are expecting an exact string match - which can be achieved with the double quotes as you have found. Without that (and with smart search enabled on the client-side) DataTables will split the input up into component words, much as Google does and search for them in any order.

    Allan

  • rubetube56rubetube56 Posts: 5Questions: 1Answers: 0

    Allan,
    I really wish I could somehow link to my page but the problem is that it is PHI and its only live in a Production environment. It would be a HIPAA violation to post that data unfortunately.

    Thank you for explaining how the string match works. Do you have any idea why the leading double quote (") would cause a Javascript error? Why would I have to put the leading double quote in at the end?

    Have you seen this issue before?

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Do you have any idea why the leading double quote (") would cause a Javascript error?

    Yeah - that's a bug. Sorry, I should have replied to that point above. I've just committed a fix for it. Thanks for pointing it out!

    Why would I have to put the leading double quote in at the end?

    You don't any more. You do if you want to close off the exact string match, but it won't cause an error if you don't - it will just so a standard "smart" search.

    Allan

  • rubetube56rubetube56 Posts: 5Questions: 1Answers: 0

    Thanks Allan.

    Sorry for all the questions, but now that you committed the fix, should I just re-download the datatables.js file? I am not referencing it from your servers, I am hosting it locally as I find it to be a bit quicker. Should I just redownload the file? If so, do you happen to have a link to the updated version?

    Thanks again for all your help!

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    The nightly version which is linked on the downloads page has the fix in it.

    I'll be releasing 1.10.3 with the fix soon.

    Allan

This discussion has been closed.