Browse Source

fix(gui-v2): deleting unsaved row

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2947/head
Pranav C 2 years ago
parent
commit
65a71b810a
  1. 6
      packages/nc-gui-v2/components/smartsheet/Grid.vue
  2. 2
      packages/nc-gui-v2/composables/useViewData.ts

6
packages/nc-gui-v2/components/smartsheet/Grid.vue

@ -191,7 +191,7 @@ onKeyStroke(['Tab', 'Shift', 'Enter', 'Delete', 'ArrowDown', 'ArrowUp', 'ArrowLe
<table class="xc-row-table nc-grid backgroundColorDefault" @contextmenu.prevent="contextMenu = true"> <table class="xc-row-table nc-grid backgroundColorDefault" @contextmenu.prevent="contextMenu = true">
<thead> <thead>
<tr class="group"> <tr class="group">
<th> <th class="w-[80px]">
<div class="flex align-center"> <div class="flex align-center">
<div class="group-hover:hidden" :class="{ hidden: selectedAllRecords }">#</div> <div class="group-hover:hidden" :class="{ hidden: selectedAllRecords }">#</div>
<div <div
@ -231,7 +231,7 @@ onKeyStroke(['Tab', 'Shift', 'Enter', 'Delete', 'ArrowDown', 'ArrowUp', 'ArrowLe
<tbody> <tbody>
<tr v-for="(row, rowIndex) in data" :key="rowIndex" class="nc-grid-row group"> <tr v-for="(row, rowIndex) in data" :key="rowIndex" class="nc-grid-row group">
<td key="row-index" class="caption nc-grid-cell"> <td key="row-index" class="caption nc-grid-cell">
<div class="align-center flex w-[80px]"> <div class="align-center flex">
<div class="group-hover:hidden" :class="{ hidden: row.rowMeta.selected }">{{ rowIndex + 1 }}</div> <div class="group-hover:hidden" :class="{ hidden: row.rowMeta.selected }">{{ rowIndex + 1 }}</div>
<div <div
:class="{ hidden: !row.rowMeta.selected, flex: row.rowMeta.selected }" :class="{ hidden: !row.rowMeta.selected, flex: row.rowMeta.selected }"
@ -332,8 +332,6 @@ onKeyStroke(['Tab', 'Shift', 'Enter', 'Delete', 'ArrowDown', 'ArrowUp', 'ArrowLe
border-bottom: 1px solid #7f828b33 !important; border-bottom: 1px solid #7f828b33 !important;
border-top: 1px solid #7f828b33 !important; border-top: 1px solid #7f828b33 !important;
border-collapse: collapse; border-collapse: collapse;
font-size: 0.8rem;
} }
td { td {

2
packages/nc-gui-v2/composables/useViewData.ts

@ -174,7 +174,7 @@ export function useViewData(
const deleteRow = async (rowIndex: number) => { const deleteRow = async (rowIndex: number) => {
try { try {
const row = formattedData.value[rowIndex] const row = formattedData.value[rowIndex]
if (row.rowMeta.new) { if (!row.rowMeta.new){
const id = meta?.value?.columns const id = meta?.value?.columns
?.filter((c) => c.pk) ?.filter((c) => c.pk)
.map((c) => row.row[c.title as any]) .map((c) => row.row[c.title as any])

Loading…
Cancel
Save