Skip to content

Commit

Permalink
Use case insensitive sort in table for strings.
Browse files Browse the repository at this point in the history
Refs #302
  • Loading branch information
mikekucera committed Jul 9, 2024
1 parent 9abec97 commit 818e612
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/client/components/network-editor/pathway-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,22 @@ const DEF_ORDER = 'desc';
const DEF_ORDER_BY = 'nes';

export const descendingComparator = (a, b, orderBy) => {
const aVal = a[orderBy], bVal = b[orderBy];

// null values come last in ascending!
if (a[orderBy] == null) {
if (aVal == null) {
return -1;
}
if (b[orderBy] == null) {
if (bVal == null) {
return 1;
}
if (b[orderBy] < a[orderBy]) {
if(typeof aVal === 'string' && typeof bVal === 'string') {
return aVal.localeCompare(bVal, undefined, { sensitivity: 'accent' });
}
if (bVal < aVal) {
return -1;
}
if (b[orderBy] > a[orderBy]) {
if (bVal > aVal) {
return 1;
}
return 0;
Expand Down

0 comments on commit 818e612

Please sign in to comment.