Sorting values with accent

Sorting values with accent

rbragarbraga Posts: 1Questions: 0Answers: 0
edited January 2010 in Bug reports
Hello everybody,

I've experienced a problem while trying to sort values with accent, since some languages have accents in their words. To solve the problem I wrote a code snippet that remove all accent before compare the string values. I hope this can help someone in the future with the same problem.

at jquery.dataTables.js

[code]
function removeAccents(strAccents){
strAccents = strAccents.split('');
strAccentsOut = new Array();
strAccentsLen = strAccents.length;
var accents = '

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi rbraga,

    Thanks for posting your alterations for this - I'm sure others will find it very useful!

    The reason it doesn't work "out of the box" with DataTables is actually due to the Javascript engines not being locale aware in their sorting. There is a localeCompare() function, but support for it is dodgy. This thread covers discussions we've had on the forum about it before: http://datatables.net/forums/comments.php?DiscussionID=397

    Regards,
    Allan
This discussion has been closed.