Prevent row bulk deletion when delete rows flag is set to false

This commit is contained in:
Andrew Kingston 2023-04-28 11:30:18 +01:00
parent 023cb2b83b
commit 80da2fb93a
2 changed files with 6 additions and 3 deletions

View File

@ -145,7 +145,9 @@
<ProgressCircle />
</div>
{/if}
<BulkDeleteHandler />
{#if allowDeleteRows}
<BulkDeleteHandler />
{/if}
<KeyboardManager />
</div>

View File

@ -13,6 +13,7 @@
clipboard,
dispatch,
selectedRows,
config,
} = getContext("grid")
const ignoredOriginSelectors = [
@ -40,7 +41,7 @@
e.preventDefault()
dispatch("add-row-inline")
} else if (e.key === "Delete" || e.key === "Backspace") {
if (Object.keys($selectedRows).length) {
if (Object.keys($selectedRows).length && $config.allowDeleteRows) {
dispatch("request-bulk-delete")
}
}
@ -106,7 +107,7 @@
break
case "Delete":
case "Backspace":
if (Object.keys($selectedRows).length) {
if (Object.keys($selectedRows).length && $config.allowDeleteRows) {
dispatch("request-bulk-delete")
} else {
deleteSelectedCell()