Fix legacy delete button in edit row modal not doing anything

This commit is contained in:
Andrew Kingston 2023-04-25 08:58:41 +01:00
parent c08db11859
commit 128411a61b
1 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<script> <script>
import CreateEditRow from "../../modals/CreateEditRow.svelte" import CreateEditRow from "../../modals/CreateEditRow.svelte"
import { getContext, onMount } from "svelte" import { getContext, onMount } from "svelte"
import { Modal } from "@budibase/bbui" import { Modal, notifications } from "@budibase/bbui"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
const { subscribe, rows } = getContext("grid") const { subscribe, rows } = getContext("grid")
@ -9,6 +9,11 @@
let modal let modal
let row let row
const deleteRow = e => {
rows.actions.deleteRows([e.detail])
notifications.success("Deleted 1 row")
}
onMount(() => onMount(() =>
subscribe("add-row", () => { subscribe("add-row", () => {
row = {} row = {}
@ -24,5 +29,9 @@
</script> </script>
<Modal bind:this={modal}> <Modal bind:this={modal}>
<CreateEditRow {row} on:updaterows={e => rows.actions.refreshRow(e.detail)} /> <CreateEditRow
{row}
on:updaterows={e => rows.actions.refreshRow(e.detail)}
on:deleteRows={deleteRow}
/>
</Modal> </Modal>