Sorting values with accent
Sorting values with accent
rbraga
Posts: 1Questions: 0Answers: 0
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 = '
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 = '
This discussion has been closed.
Replies
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