From 916c104a7052ce94b9284a68e1509ed1e961a837 Mon Sep 17 00:00:00 2001 From: Bjarke Madsen <bjarke@nordu.net> Date: Thu, 7 Dec 2023 14:25:34 +0100 Subject: [PATCH] Sort NRENs properly in NREN selection menu --- compendium-frontend/src/components/graphing/Filter.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compendium-frontend/src/components/graphing/Filter.tsx b/compendium-frontend/src/components/graphing/Filter.tsx index 2405e45b..b34f08a5 100644 --- a/compendium-frontend/src/components/graphing/Filter.tsx +++ b/compendium-frontend/src/components/graphing/Filter.tsx @@ -78,7 +78,9 @@ function Filter({ filterOptions, filterSelection, setFilterSelection, max1year = const nrOfColumns = isThirdColumnVisible ? 3 : 2; const nrOfRows = Math.ceil(filterOptions.availableNrens.length / nrOfColumns); const grid: Nren[][] = Array.from(Array(nrOfColumns), () => []); - filterOptions.availableNrens.sort().forEach((nren, idx) => { + filterOptions.availableNrens.sort((a,b) => { + return a.name.localeCompare(b.name); + }).forEach((nren, idx) => { const col = Math.floor(idx / nrOfRows); grid[col].push(nren); }); -- GitLab