From 163e4c8060a8a1a5035888d2531f7064a69a2112 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Tue, 5 Jan 2021 07:47:02 +0100 Subject: [PATCH] Cards, custom fields are displayed in alphabetic order - until now the order is undefined, it's different from card to card, it's the order in which the custom fields were added to the card. --- models/cards.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/cards.js b/models/cards.js index 8475db937..e2aa6a7e4 100644 --- a/models/cards.js +++ b/models/cards.js @@ -650,7 +650,7 @@ Cards.helpers({ // match right definition to each field if (!this.customFields) return []; - return this.customFields.map(customField => { + let ret = this.customFields.map(customField => { const definition = definitions.find(definition => { return definition._id === customField._id; }); @@ -676,6 +676,8 @@ Cards.helpers({ definition, }; }); + ret.sort((a, b) => a.definition.name.localeCompare(b.definition.name)); + return ret; }, colorClass() {