Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mkranj opened this issue Aug 16, 2023 · 0 comments
Open

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

Mkranj opened this issue Aug 16, 2023 · 0 comments

Comments

@Mkranj
Copy link

Mkranj commented Aug 16, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant