From 8df1b9253aae06c8b42a37b36100a595e4e7c74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Wodzyn=CC=81ski?= Date: Fri, 24 Nov 2023 11:00:11 +0100 Subject: [PATCH] Sorting in PropertyChecker now takes layer's caption into account. --- .../src/plugins/PropertyChecker/views/PropertyItem.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/new-client/src/plugins/PropertyChecker/views/PropertyItem.js b/new-client/src/plugins/PropertyChecker/views/PropertyItem.js index f7d4021fe..3fa180187 100644 --- a/new-client/src/plugins/PropertyChecker/views/PropertyItem.js +++ b/new-client/src/plugins/PropertyChecker/views/PropertyItem.js @@ -100,9 +100,12 @@ function PropertyItem({ const bid = b.get("id"); // If we've got nice strings, let's user localeCompare to sort. Else // just assume the elements are equal. - return typeof aid === "string" && typeof bid === "string" - ? aid.localeCompare(bid) - : 0; + return ( + a.get("caption").localeCompare(b.get("caption")) || // First, sort on caption. + (typeof aid === "string" && typeof bid === "string" // Next, group by layer ID. + ? aid.localeCompare(bid) + : 0) + ); }) .map((f, j) => { const olLayer = olMap