Accent neutralise search area

Accent neutralise search area

Chris_fr7Chris_fr7 Posts: 3Questions: 1Answers: 0

Hello,

I need to neutralise accent in search area. For example in French : éd... -> édition or ed... -> édition.

The solution in the discussion https://datatables.net/forums/discussion/42829/accent-neutralise-search-localecompare-sorting?
works very well. You can see it https://jsfiddle.net/d9vtu79g/

But i have a stupid problem. I searched but i can integrate it with my script.

In the solution, table is initialized by var table = $('#example').DataTable({ columnDefs : [{ targets: 0, type: 'locale-compare' },]}).

In my script, table is initialized by $('#example').DataTable({ "order": [[ 0, "desc" ]], "columnDefs": [{"targets": [ 0 ],"visible": true,"searchable": true,... with $.extend( $.fn.dataTable.defaults, {autoWidth: false, columnDefs: [{ orderable: false, width: '100px', targets: [ 5 ]...

Is it possible to use locale-compare in my case and how ?

Or do I have to change the shape of all my scripts ?

Thank you very much for your help.

Chris

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Add { targets: 0, type: 'locale-compare' } into your columnDefs array (assuming you want it only on column index 0).

    Allan

  • Chris_fr7Chris_fr7 Posts: 3Questions: 1Answers: 0

    Hello Allan,

    At first I thought it was a syntax problem.

    With your answer, i found the problem came from the function $.fn.dataTable.defaults in my script.

    Thank you very much.

    Chris

  • MSLtdMSLtd Posts: 56Questions: 5Answers: 4

    Hey @Chris_fr7 , could you mark Allans comment above as the answer, your post is sitting in the unanswered questions page at the moment :wink:

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    edited July 2018

    I've updated it. @Chris_fr7 - good to hear you've got it working now.

    Allan

This discussion has been closed.