Skip to content

Sort rows in locale with characters not found in English #123

@Mkranj

Description

@Mkranj

Hi, I have a variable that I'd like to sort my data by rows in rpivotTable. The issue is, since the data is in Croatian which uses some letters not found in English, the output is not alphabetically sorted, e.g. it sorts first by English characters, and then by Croatian.

Example:

engleski, francuski, hrvatski, talijanski, češki, španjolski

Expected order:

češki, engleski, francuski, hrvatski, španjolski, talijanski

Can I somehow define the character order in a locale?
Here is a somewhat related solution I wrote for correctly sorting the months of a year:

sortiranje_mjeseci_js = "
        function(attr) {
        var sortAs = $.pivotUtilities.sortAs;
        if (attr == \"Mjesec\") { return sortAs([\"siječanj\", \"veljača\", \"ožujak\", \"travanj\", \"svibanj\", \"lipanj\", \"srpanj\", \"kolovoz\", \"rujan\", \"listopad\", \"studeni\", \"prosinac\", \"nepoznato\"]); }
        }"

and then I passed that to the sorters argument of pivotTable. However, I can't do the same for the variable I describe first because not all values are known in advance. I'd be grateful for any tips!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions