diff --git a/packages/standard-components/src/DataGrid/Component.svelte b/packages/standard-components/src/DataGrid/Component.svelte index 8ab9e90ffe..9e0e1699aa 100644 --- a/packages/standard-components/src/DataGrid/Component.svelte +++ b/packages/standard-components/src/DataGrid/Component.svelte @@ -12,7 +12,6 @@ import { onMount } from "svelte" import AgGrid from "@budibase/svelte-ag-grid" - import InputForm from "./InputForm.svelte" import CreateRowButton from "./CreateRow/Button.svelte" import { TextButton as DeleteButton, Icon } from "@budibase/bbui" @@ -23,10 +22,12 @@ let data let columnDefs let selectedRows = [] + let model onMount(async () => { const jsonModel = await _bb.api.get(`/api/models/${datasource.modelId}`) - const { schema } = await jsonModel.json() + model = await jsonModel.json() + const { schema } = model if (!isEmpty(datasource)) { data = await fetchData(datasource) columnDefs = Object.keys(schema).map((key, i) => { @@ -34,7 +35,7 @@ headerCheckboxSelection: i === 0, checkboxSelection: i === 0, valueSetter: setters.get(schema[key].type), - headerName: key.charAt(0).toUpperCase() + key.slice(1), // Capitalise first letter + headerName: key.charAt(0).toUpperCase() + key.slice(1), field: key, hide: shouldHideField(key), sortable: true, @@ -88,16 +89,16 @@
-
- - {#if selectedRows.length > 0} - - - Delete {selectedRows.length} row(s) - - {/if} -
{#if dataLoaded} +
+ + {#if selectedRows.length > 0} + + + Delete {selectedRows.length} row(s) + + {/if} +
import { DropdownMenu, TextButton as Button, Icon } from "@budibase/bbui" - // import CreateEditRecord from "../modals/CreateEditRecord.svelte" + import Modal from "./Modal.svelte" let anchor let dropdown + + export let _bb, model
@@ -14,8 +16,7 @@
Add New Row
- popup goes here! - +