From 1dc406e1d7b73456626da2108809632066f5c12f Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Thu, 2 Jul 2020 21:22:21 +0100 Subject: [PATCH] DataTable should not display type & modelId --- packages/standard-components/src/DataTable.svelte | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/DataTable.svelte b/packages/standard-components/src/DataTable.svelte index e6f097314c..6782a9925c 100644 --- a/packages/standard-components/src/DataTable.svelte +++ b/packages/standard-components/src/DataTable.svelte @@ -8,6 +8,16 @@ let headers = [] let store = _bb.store + const shouldDisplayField = name => { + if (name.startsWith("_")) return false + // always 'record' + if (name === "type") return false + // tables are always tied to a single modelId, this is irrelevant + if (name === "modelId") return false + + return true + } + async function fetchData() { const FETCH_RECORDS_URL = `/api/views/all_${model}` @@ -20,7 +30,7 @@ return state }) - headers = Object.keys(json[0]).filter(key => !key.startsWith("_")) + headers = Object.keys(json[0]).filter(shouldDisplayField) } else { throw new Error("Failed to fetch records.", response) }