From c76dccb66cb6d4e5ce1ff92700136aa59e20b39f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 13 Oct 2020 09:22:47 +0100 Subject: [PATCH] Add relationships as possible datasource for grid --- .../standard-components/src/DataGrid/Component.svelte | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/standard-components/src/DataGrid/Component.svelte b/packages/standard-components/src/DataGrid/Component.svelte index 01ed620a5c..5d85f66da7 100644 --- a/packages/standard-components/src/DataGrid/Component.svelte +++ b/packages/standard-components/src/DataGrid/Component.svelte @@ -17,7 +17,7 @@ export let _bb export let datasource = {} export let editable - export let theme = 'alpine' + export let theme = "alpine" let dataLoaded = false let data @@ -33,6 +33,7 @@ rowSelection: editable ? "multiple" : false, suppressRowClickSelection: !editable, } + let store = _bb.store onMount(async () => { if (datasource.modelId) { @@ -40,7 +41,7 @@ model = await jsonModel.json() const { schema } = model if (!isEmpty(datasource)) { - data = await fetchData(datasource) + data = await fetchData(datasource, $store) columnDefs = Object.keys(schema).map((key, i) => { return { headerCheckboxSelection: i === 0 && editable, @@ -64,8 +65,8 @@ type !== "boolean" && type !== "options" && // type !== "datetime" && - type !== "link" && - type !== "attachment" + type !== "link" && + type !== "attachment" const shouldHideField = name => { if (name.startsWith("_")) return true