Browse Source

Merge pull request #1640 from mertmit/cell-update-onunload

fix: force cell update on unload if unsaved
pull/1672/head
աɨռɢӄաօռɢ 3 years ago committed by GitHub
parent
commit
abbcf94339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

16
packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue

@ -225,6 +225,7 @@
@cancel="editEnabled = {};"
@update="onCellValueChange(col, row, columnObj, false)"
@blur="onCellValueChange(col, row, columnObj, true)"
@input="unsaved = true"
@navigateToNext="navigateToNext"
@navigateToPrev="navigateToPrev"
/>
@ -343,7 +344,8 @@ export default {
},
aggCount: [],
dragOver: false,
gridViewCols: {}
gridViewCols: {},
unsaved: false
}),
computed: {
selectAll: {
@ -419,6 +421,15 @@ export default {
document.addEventListener('keydown', this.onKeyDown)
this.loadGridViewCols()
this.xcAuditModelCommentsCount()
const self = this
window.addEventListener('beforeunload', function() {
if (self.unsaved) {
if (self.editEnabled.row != null && self.editEnabled.row != null) {
const columnObj = self.availableColumns[self.editEnabled.col]
self.onCellValueChange(self.editEnabled.col, self.editEnabled.row, columnObj, true)
}
}
})
},
beforeDestroy() {
document.removeEventListener('keydown', this.onKeyDown)
@ -648,6 +659,9 @@ export default {
},
onCellValueChange(col, row, column, saved) {
this.$emit('onCellValueChange', col, row, column, saved)
if (saved) {
this.unsaved = false
}
},
navigateToNext() {
if (this.selected.row < this.rowLength - 1) {

Loading…
Cancel
Save