Question

I have a problem with the column sorting in jQuery Datatable. According to Turkish alphabet, the order of the datatable sorting is wrong. How can I achieve to get the correct result of the sorting Turhish ?

Was it helpful?

Solution

you can solve this issue with replacing _fnEscapeRegex function like this // _fnEscapeRegex fonksiyonunu aşağıdaki gibi değiştirerek bu sorunu çözebilirsiniz...

function _fnEscapeRegex ( sVal ) {

var letters = { "İ": "[İi]", "I": "[Iı]", "Ş": "[Şş]", "Ğ": "[Ğğ]", "Ü": "[Üü]", "Ö": "[Öö]", "Ç": "[Çç]", "i": "[İi]", "ı": "[Iı]", "ş": "[Şş]", "ğ": "[Ğğ]", "ü": "[Üü]", "ö": "[Öö]", "ç": "[Çç]" };
        var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ];
        var reReplace = new RegExp( '(\\' + acEscape.join('|\\') + ')', 'g' );
        sVal=sVal.replace(reReplace, '\\$1');

        return sVal.replace(/(([İIŞĞÜÇÖiışğüçö]))/g, function (letter) { return letters[letter]; });
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top