From 671d7d09067dc59eb0152e0f38517ce252ea864f Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 30 Nov 2021 20:14:41 +0530 Subject: [PATCH] fix: show primary value in hasmany (in newly created row) save row on adding new hasmany/manytomany value re #823 Signed-off-by: Pranav C --- .../project/spreadsheet/components/virtualCell/hasManyCell.vue | 3 ++- .../spreadsheet/components/virtualCell/manyToManyCell.vue | 1 + .../nc-gui/components/project/spreadsheet/views/xcGridView.vue | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue index 489c904d7c..43cbf9a830 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue @@ -350,6 +350,7 @@ export default { if (this.isNew && this.localState.every(it => it[this.childForeignKey] !== child[this.childPrimaryKey])) { this.localState.push(child) this.$emit('update:localState', [...this.localState]) + this.$emit('saveRow') this.newRecordModal = false return } @@ -394,7 +395,7 @@ export default { }, getCellValue(cellObj) { if (cellObj) { - if (this.parentMeta && this.childPrimaryCol) { + if (this.childMeta && this.childPrimaryCol) { return cellObj[this.childPrimaryCol] } return Object.values(cellObj)[1] diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue index 927ee26260..318765ad5d 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue @@ -385,6 +385,7 @@ export default { if (this.isNew && this.localState.every(it => it[this.childForeignKey] !== child[this.childPrimaryKey])) { this.localState.push(child) this.$emit('update:localState', [...this.localState]) + this.$emit('saveRow') this.newRecordModal = false return } diff --git a/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue b/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue index e1977f58f3..2d5a442896 100644 --- a/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue +++ b/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue @@ -185,6 +185,7 @@ :is-new="rowMeta.new" v-on="$listeners" @updateCol="(...args) => updateCol(...args, columnObj.bt && meta.columns.find( c => c.cn === columnObj.bt.cn), col, row)" + @saveRow="onCellValueChange(col, row, columnObj)" />