Browse Source

feat: Confirmation on delete record

Co-authored-by: gitstart <gitstart@gitstart.com>
Co-authored-by: frankmagoba <franklinmagoba4@gmail.com>
Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
pull/5419/head
gitstart 2 years ago
parent
commit
521a94326c
  1. 19
      packages/nc-gui/components/smartsheet/Grid.vue

19
packages/nc-gui/components/smartsheet/Grid.vue

@ -752,6 +752,23 @@ const closeAddColumnDropdown = () => {
columnOrder.value = null columnOrder.value = null
addColumnDropdown.value = false addColumnDropdown.value = false
} }
const deleteRowModal = (row: number) => {
Modal.confirm({
title: `Do you want to delete this row?`,
wrapClassName: 'nc-modal-attachment-delete',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
onOk() {
try {
deleteRow(row)
} catch (e: any) {
message.error(e.message)
}
},
})
}
</script> </script>
<template> <template>
@ -973,7 +990,7 @@ const closeAddColumnDropdown = () => {
<template v-if="!isLocked && hasEditPermission" #overlay> <template v-if="!isLocked && hasEditPermission" #overlay>
<a-menu class="shadow !rounded !py-0" @click="contextMenu = false"> <a-menu class="shadow !rounded !py-0" @click="contextMenu = false">
<a-menu-item v-if="contextMenuTarget" @click="deleteRow(contextMenuTarget.row)"> <a-menu-item v-if="contextMenuTarget" @click="deleteRowModal(contextMenuTarget.row)">
<div v-e="['a:row:delete']" class="nc-project-menu-item"> <div v-e="['a:row:delete']" class="nc-project-menu-item">
<!-- Delete Row --> <!-- Delete Row -->
{{ $t('activity.deleteRow') }} {{ $t('activity.deleteRow') }}

Loading…
Cancel
Save