From a80fe7d7d8213e66d5413ef10fc1c6c58612217c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 21 Mar 2022 09:44:24 +0000 Subject: [PATCH] Set a required constraint for a column that is defaulted to being the primary display --- .../backend/DataTable/modals/CreateEditColumn.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index c946dbf9d8..aa3915de58 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -12,7 +12,7 @@ Modal, notifications, } from "@budibase/bbui" - import { createEventDispatcher } from "svelte" + import { createEventDispatcher, onMount } from "svelte" import { cloneDeep } from "lodash/fp" import { tables } from "stores/backend" import { TableNames, UNEDITABLE_USER_FIELDS } from "constants" @@ -321,6 +321,12 @@ } return newError } + + onMount(() => { + if (primaryDisplay) { + field.constraints.presence = { allowEmpty: false } + } + })