Searchpane doesn't return results if item contains an ampersand (&)

Searchpane doesn't return results if item contains an ampersand (&)

jmbishopjmbishop Posts: 4Questions: 2Answers: 0

In my Searchpane I have a list of categories. It displays all the categories available and indicates the number of items in that category. However, if one of the categories has an ampersand (Jams & Jellies), even though it indicates there are items in that category when you click on it to filter it clears the datatable and returns zero results.

Thanks for any assistance,
J Bishop

This question has accepted answers - jump to:

Answers

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421
    edited November 2018

    Tried it with a normal search field. And had absolutely no issues. Without your code it will be difficult to figure this out.

    Changed the text to your "Jams & Jellies" and just entered an ampersand into the filter field. Worked.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, as @rf1234 said, this needs a test case. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi all,

    I was able to reproduce this (it was mentioned on github) - see here.

    This has now been fixed. It will be incorporated into the next DataTables release, but you can get it from here if you want it in the meantime,

    Cheers,

    Colin

  • yakov116yakov116 Posts: 34Questions: 5Answers: 0

    @colin can searchpanes be added to the nightly releases?

  • allanallan Posts: 63,530Questions: 1Answers: 10,473 Site admin

    That's the longer term plan. SearchPane is going to be promoted to be a fully supported extension (like Buttons, FixedHeader, etc), but there are a number of items we need to finish for it first - not least the documentation!

    Allan

  • yakov116yakov116 Posts: 34Questions: 5Answers: 0

    @allen can searchpanes be added to the nightly releases? (I dont mind a not finished product). Like this I get the latest.

  • ezezezezezez Posts: 5Questions: 2Answers: 0

    While this thread goes back about 1.5 years, I believe I am seeing a similar issue now. If I have a searchPane filter that has an entry that includes and ampersand "&" the datatable will not show any results.

    JSZip 2.5.0, DataTables 1.10.22, Buttons 1.6.4, Column visibility 1.6.4, HTML5 export 1.6.4, Print view 1.6.4, ColReorder 1.5.2, FixedHeader 3.1.7, Responsive 2.2.6, SearchPanes 1.2.0, Select 1.3.1

    I have recorded a brief video showing the issue:
    https://youtu.be/n0SBWcv9LfE

    If it helps, this is link to the page that will load the datatable with a searchPane filter that has the ampersand:
    https://gdanalyst.herokuapp.com/pbp?gameid=8114397

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    This thread is for SearchPanes v1, we're on v2 now!

    That said, it's not working on the released version of v2, which you're using, but it is on the nightly version - see here: http://live.datatables.net/fapuzusa/6/edit

    We're aiming on releasing 1.2.2 (which will contain the fix) in the next week or two, but in the meantime the nightly build would get you going.

    Apologies for the inconvenience,

    Colin

  • ezezezezezez Posts: 5Questions: 2Answers: 0

    Got it, thank you!

  • woodsalexjwoodsalexj Posts: 21Questions: 6Answers: 0

    I'm using SearchBuilder 1.3.0 and I have the same issue. Any update there at all?

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @woodsalexj ,

    Thanks for pointing this out. Something isn't right there. I've raised an issue internally (DD- for my reference) and will report back here when there is an update. I also created a test case to show this which you can find here.

    Thanks,
    Sandy

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    @sandy FYI I answered the same question in @woodsalexj other thread. Maybe it will help.

    Kevin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Thanks @kthorngren . I'll reply there to keep it all in the same thread :)

  • Christian FriebelChristian Friebel Posts: 3Questions: 0Answers: 1

    Hi Community,

    I am stuck with the SearchPane(s) and & (&) in values. I tried around with several versions of datatables.min.js and dataTables.searchPane.min.js, but I have no success with data containing and "&" (or HTML translated (&)).

    I bypass the problem by stringreplace the "&" to an "and", but that's not the way it should work.
    I tried around with the nightly build versions, but still no success.

    Is there anything I missed, or is this still in development?

    Thank you,
    Chris

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421
    edited January 2023
  • Christian FriebelChristian Friebel Posts: 3Questions: 0Answers: 1
    Answer ✓

    Hi,

    sorry for the circumstances.... I had loaded SearchPane(s) twice in my code. Once with SearchPane.js, the other with SearchPanes.js. There was a logic conflict.
    Once I deleted the "old" Version, everything work like expected.

    Thank you anyway!

  • allanallan Posts: 63,530Questions: 1Answers: 10,473 Site admin

    Thanks for the update - good to hear it is working now.

    Allan

Sign In or Register to comment.