From b9c82144768ca26306297748f10e6ef8a8eee287 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 24 Mar 2021 19:13:38 +0000 Subject: [PATCH] Improve table column sorting to put auto cols last --- packages/standard-components/manifest.json | 2 +- packages/standard-components/src/table/Table.svelte | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index 5c110d2d12..65fcec339b 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -1529,7 +1529,7 @@ }, { "type": "boolean", - "label": "Show Auto Cols.", + "label": "Auto Cols.", "key": "showAutoColumns", "defaultValue": false }, diff --git a/packages/standard-components/src/table/Table.svelte b/packages/standard-components/src/table/Table.svelte index 24eb2d121f..7f3a4b15f6 100644 --- a/packages/standard-components/src/table/Table.svelte +++ b/packages/standard-components/src/table/Table.svelte @@ -65,12 +65,15 @@ return customColumns } let columns = [] + let autoColumns = [] Object.entries(schema).forEach(([field, fieldSchema]) => { - if (showAutoColumns || !fieldSchema?.autocolumn) { + if (!fieldSchema?.autocolumn) { columns.push(field) + } else if (showAutoColumns) { + autoColumns.push(field) } }) - return columns + return columns.concat(autoColumns) }