diff --git a/src/components/VDataTable/VEditDialog.js b/src/components/VDataTable/VEditDialog.js index 35f9e30917d..09df0f9d9f7 100644 --- a/src/components/VDataTable/VEditDialog.js +++ b/src/components/VDataTable/VEditDialog.js @@ -16,8 +16,7 @@ export default { data () { return { - isActive: false, - isSaving: false + isActive: false } }, @@ -39,13 +38,19 @@ export default { watch: { isActive (val) { - val && setTimeout(this.focus, 50) // Give DOM time to paint + if (val) { + this.$emit('open') + setTimeout(this.focus, 50) // Give DOM time to paint + } else { + this.$emit('close') + } } }, methods: { cancel () { this.isActive = false + this.$emit('cancel') }, focus () { const input = this.$refs.content.querySelector('input') @@ -66,7 +71,10 @@ export default { 'class': 'v-small-dialog__actions' }, [ this.genButton(this.cancel, this.cancelText), - this.genButton(() => this.save(this.returnValue), this.saveText) + this.genButton(() => { + this.save(this.returnValue) + this.$emit('save') + }, this.saveText) ]) }, genContent () { @@ -75,7 +83,10 @@ export default { keydown: e => { const input = this.$refs.content.querySelector('input') e.keyCode === keyCodes.esc && this.cancel() - e.keyCode === keyCodes.enter && input && this.save(input.value) + if (e.keyCode === keyCodes.enter && input) { + this.save(input.value) + this.$emit('save') + } } }, ref: 'content'