Browse Source

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 <pranavxc@gmail.com>
pull/865/head
Pranav C 3 years ago
parent
commit
671d7d0906
  1. 3
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue
  2. 1
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/manyToManyCell.vue
  3. 1
      packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

3
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]

1
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
}

1
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)"
/>
<editable-cell

Loading…
Cancel
Save