if type: 'diacritics-neutralise', problem with filtering (at 3 characters)

if type: 'diacritics-neutralise', problem with filtering (at 3 characters)

XavlightXavlight Posts: 7Questions: 2Answers: 0

Hi,
I'm having a problem filtering when I have labels with accented capital letters that need to be sorted correctly.

To sort with accented characters in the 1st letter, I use this library:
<script src=“https://cdn.datatables.net/plug-ins/2.1.7/sorting/diacritics-sort.js”></script>
in conjunction with the 'type' parameter: { targets: 1, type: 'diacritics-neutralise' }

To filter accented characters, I use this library :
<script src=“https://cdn.datatables.net/plug-ins/2.1.8/filtering/type-based/accent-neutralise.js”></script>

As soon as I set the 'type' parameter: { targets: 1, type: 'diacritics-neutralise' }
Sorting is correct but filtering becomes incorrect.
Test filtering: etu - **nothing found **

If I don't set the 'type' parameter, then my sorting is incorrect, but the search is correct.
Test filtering: etu - found: "Études et conseils"

Example with correct sort and incorrect search (from the 3rd character).
In the code, highlight the type parameter to obtain the opposite.
https://live.datatables.net/jupopoma/1/edit

Is there another method or library for sorting?
It's as if these 2 library weren't compatible.

Are there any other ways around the problem?
Sorry for my English, I used a translator.

Xav

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin

    Your example was loading DataTables 1.x. Use DataTables 2 which has built in support for diacritic sorting and filtering - updated example.

    Allan

  • XavlightXavlight Posts: 7Questions: 2Answers: 0

    Hi Allan,

    Sorry for the mistake I made in generating the example. (mix of libraries)
    That's not the problem, but I've identified it.

    In fact, in the table field of my 2nd column, I add a span with a Font Awesome picto.
    This is where the sorting doesn't work properly.
    If, of course, there is no such span, the sorting works correctly.

    Maybe I can do something else instead of the span, so as not to disrupt the sorting?

    https://live.datatables.net/jupopoma/3/edit

    Thank you very much for your help.

    Xav

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin

    Ah - thank you. You've discovered a hole in my UTF-8 support in DataTables 2.1! There is a string-utf8 type, but there isn't an html-utf8 type. An oversight on my part that. Sorry.

    I'll need to look at adding that. One option in the meantime would be to put the icon into its own column.

    Allan

  • XavlightXavlight Posts: 7Questions: 2Answers: 0

    Hi Allan,
    Thanks Allan, yes, that's a possibility I didn't want from the outset of creating my data table. :#

    I'll wait a bit if you manage to make this improvement, if not, I'll make an extra column.

    Thank you very much for your responsiveness.

    Xav

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin
    edited December 3 Answer ✓

    Hi Xav,

    I've committed a change to add a new html-utf8 data type to DataTables to support this.

    The nightly build now includes this change and the example works as would be hoped now.

    This will ship in DataTables 2.1.9 which I hope to release fairly soon. Possibly the end of the week.

    Allan

  • XavlightXavlight Posts: 7Questions: 2Answers: 0
    edited December 3

    Hi Allan,

    Perfect.
    Really, thank you very much for your efficiency.

    Example with nightly : https://live.datatables.net/jupopoma/5/edit

    Xav

Sign In or Register to comment.