sandialabs/slycat

Use locale specific sorting across Slycat

Opened this issue · 2 comments

@smartin71 wrote back in April 2022:

A Dial-A-Cluster user was complaining about the sorting in the table when there were strings with numbers. It would sort “Number 1”, “Number 2”, …, “Number 100” as “Number 1”, “Number 10”, “Number 100”, ….

I looked around the internet and found something called localeCompare in JavaScript that can handle this problem and sort as a human would sort when there are numbers in the strings.

https://fuzzytolerance.info/blog/2019/07/19/The-better-way-to-do-natural-sort-in-JavaScript/

I mention this in case it would be something you might want to add to the tables in the other models. (Although I don’t know that anyone else has ever complained about this particular issue.)

This affects many parts of Slycat and we should be consistent with how we sort. I started using localeCompare in the histogram, and @smartin71 is using it in DAC. It should be fairly easy to convert older parts of Slycat to use the same sorting method.

DAC model can use localeSort because it does slickGrid table sorting on the front end. The rest of the models have to rely on table sorting on the server because they can't count on downloading all the table data at once due to potentially very large sizes. So locale specific sorting would need to happen on the server.