From b952892c42587c04d1bcc1608c156de215178d23 Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 25 Oct 2023 12:08:56 +0100 Subject: [PATCH] Generalised the fix as not all calculations will have a groupby per PR feedback --- .../src/components/backend/DataTable/Table.svelte | 4 +++- .../backend/DataTable/ViewDataTable.svelte | 15 +-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index 45e440eca5..f7eccd5242 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -28,7 +28,9 @@ $: if (schema) { parsedSchema = Object.keys(schema).reduce((acc, key) => { - acc[key] = { ...schema[key] } + acc[key] = + typeof schema[key] === "string" ? { type: schema[key] } : schema[key] + if (!canBeSortColumn(acc[key].type)) { acc[key].sortable = false } diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index 12e4e3c270..6068439dbd 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -19,21 +19,8 @@ let loading = false let type = "internal" - // Grouped views have a fixed schema layout - const parseSchema = view => { - if (!view.groupBy) { - return view.schema - } - const { group, field, value } = view.schema - return { - group, - field: { type: field }, - value: { type: value }, - } - } - $: name = view.name - $: schema = parseSchema(view) + $: schema = view.schema $: calculation = view.calculation $: supportedFormats = Object.values(ROW_EXPORT_FORMATS).filter(key => {