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
TablePanel: Make sorting case-insensitive #32435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works as expected!
Friendly reminder to change title to be change log compatible, add appropriate labels, milestone and backport label so this issue gets shipped in the next patch release. |
might also consider https://stackoverflow.com/a/51005583 |
@leeoniya Oh that's very nice, had no idea that existed. Will change to make use of that. |
sorry, last drive-by comment: caching the locale object outside the sort loop should be faster, too: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator something like let myCompare = new Intl.Collator('sv', { sensitivity: 'base' }).compare;
stringsArray.sort(myCompare); |
I saw mention of that |
Hi! We have a fork of Grafana 7.3.2 and I'm fixing the same issue. The fix you are discussing here looks good except typings. The following method export function sortCaseInsensitive(a: Row<any>, b: Row<any>, id: string) {
return a.values[id].localeCompare(b.values[id], undefined, { sensitivity: 'base' });
} allows to pass non-string values which don't have "localeCompare" method. For example, |
Thanks for catching this! Pushed a fix |
* origin/master: (96 commits) Introduce "scuemata" system for CUE-based specification of Grafana objects (grafana#32527) Toolkit: catch errors in version output (grafana#32774) safer, more idiomatic proxy helper (grafana#32732) Themes: V8 Theme model (grafana#32342) CloudWatch: replace full query parser with regex scanner that extracts stats groups (grafana#32610) Input: updates story from knobs to control (grafana#32712) Explore: correctly cleanup state on unmount (grafana#32557) Add timeout option to datasource config (grafana#31871) Chore: move errors to enterprise (grafana#32753) Update latest.json to 7.5.3 (grafana#32755) SSE: fix casing on classic conditions model. (grafana#32754) Improve error handling for Graphite 0.9 and 1.0 (grafana#32642) Table: Fixes table data links so they refer to correct row after sorting (grafana#32571) ReleaseNotes: Updated changelog and release notes for 7.5.3 (grafana#32749) TablePanel: Makes sorting case-insensitive (grafana#32435) Bump github.com/influxdata/influxdb-client-go/v2 from 2.2.2 to 2.2.3 (grafana#32683) add memcached integration test steps in starlark (grafana#32729) AlertingNG: Temp endpoint to translate dashboard alert into rule group (grafana#32694) Prometheus: Show only graph for range queries in Explore (grafana#32489) LibraryPanels: Add search input back to add panel widget (grafana#32719) ...
What this PR does / why we need it:
Adds a sort type 'alphanumeric-insensitive' to the
Table
component and makes it the default for non-numeric fields.Which issue(s) this PR fixes:
Closes #30476
Special notes for your reviewer: