From 2a2a6c253d2e7f589f87877f48f3ae3f5621c7c2 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 28 Sep 2022 12:12:50 +0800 Subject: [PATCH] feat(nocodb): choose text / number in kanban fields first --- packages/nocodb/src/lib/models/View.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts index 740b445d56..c622d8f3bc 100644 --- a/packages/nocodb/src/lib/models/View.ts +++ b/packages/nocodb/src/lib/models/View.ts @@ -359,14 +359,25 @@ export default class View implements ViewType { let kanbanAttachmentCount = 0; if (view.type === ViewTypes.KANBAN && !copyFromView) { - // sort by primary value & attachment first, then by order + // sort by primary value & attachment first, then by singleLineText & Number // so that later we can handle control `show` easily columns.sort((a, b) => { const primaryValueOrder = b.pv - a.pv; const attachmentOrder = +(b.uidt === UITypes.Attachment) - +(a.uidt === UITypes.Attachment); + const singleLineTextOrder = + +(b.uidt === UITypes.SingleLineText) - + +(a.uidt === UITypes.SingleLineText); + const numberOrder = + +(b.uidt === UITypes.Number) - +(a.uidt === UITypes.Number); const defaultOrder = b.order - a.order; - return primaryValueOrder || attachmentOrder || defaultOrder; + return ( + primaryValueOrder || + attachmentOrder || + singleLineTextOrder || + numberOrder || + defaultOrder + ); }); }