Sort problem with swedish characters

Sort problem with swedish characters

tidelipoptidelipop Posts: 10Questions: 0Answers: 0
edited November 2009 in General
I'm using UTF-8 and when I click a column names starting with the swedish character

Replies

  • allanallan Posts: 61,853Questions: 1Answers: 10,134 Site admin
    Hi tidelipop,

    Have a look at this thread which covers this topic: http://datatables.net/forums/comments.php?DiscussionID=397 .

    Regards,
    Allan
  • tidelipoptidelipop Posts: 10Questions: 0Answers: 0
    I've tried it in Firefox and in IE7, doesn't work.

    Is it correct of me to change the code like below? ..or is it somewhere else I should do the change?
    [code]
    /*
    * Variable: oSort
    * Purpose: Wrapper for the sorting functions that can be used in DataTables
    * Scope: jQuery.fn.dataTableExt
    * Notes: The functions provided in this object are basically standard javascript sort
    * functions - they expect two inputs which they then compare and then return a priority
    * result. For each sort method added, two functions need to be defined, an ascending sort and
    * a descending sort.
    */
    _oExt.oSort = {
    /*
    * text sorting
    */
    "string-asc": function ( a, b )
    {
    var x = a.toLowerCase();
    var y = b.toLowerCase();
    return x.localeCompare(y);
    //return ((x < y) ? -1 : ((x > y) ? 1 : 0));
    },

    "string-desc": function ( a, b )
    {
    var x = a.toLowerCase();
    var y = b.toLowerCase();
    return y.localeCompare(x);
    //return ((x < y) ? 1 : ((x > y) ? -1 : 0));
    },
    [/code]
  • allanallan Posts: 61,853Questions: 1Answers: 10,134 Site admin
    Hi tidelipop,

    Yes that's how I think it would be used ( http://msdn.microsoft.com/en-us/library/62b7ahzy(VS.85).aspx ). If that doesn't work, try adding in some debug expressions to see what IE thinks it is doing... I haven't really used this function much myself, so I'm not sure of how much help I'll be able to be...

    Regards,
    Allan
This discussion has been closed.