From a115910032cc7ce0e806f20c706601ed69a6ab9c Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Tue, 29 Apr 2025 13:02:51 +0200 Subject: [PATCH] fixed new model classes without model --- .../vue/tt-components/tt-position-manager.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/public/plugins/vue/tt-components/tt-position-manager.js b/public/plugins/vue/tt-components/tt-position-manager.js index 8428df074..1e321d9ee 100644 --- a/public/plugins/vue/tt-components/tt-position-manager.js +++ b/public/plugins/vue/tt-components/tt-position-manager.js @@ -181,6 +181,11 @@ Vue.component('tt-positions-manager', this.$set(this.formData, key + '_text', this.$refs['autocomplete-' + key][0].displayValue); this.$delete(this.formData, key); } + + if (field.emitDisplayValue && this.formData[key] !== null && this.formData[key] !== undefined) { + this.$delete(this.formData, key + '_text'); + } + } }, async saveEntry() { @@ -202,8 +207,17 @@ Vue.component('tt-positions-manager', this.positions.push({_group: this.groupName}); this.groupName = ''; }, - editEntry(index) { + async editEntry(index) { this.selectedIndex = index; + for (const [key, field] of Object.entries(this.config.fields)) { + if (field.type === 'autocomplete' && field.emitDisplayValue && this.$refs['autocomplete-' + key][0]) { + await this.$nextTick(); + if (this.positions[index][key + '_text']) { + this.$refs['autocomplete-' + key][0].displayValue = this.positions[index][key + '_text']; + this.$set(this.formData, key, this.positions[index][key]); + } + } + } this.formData = {...this.positions[index]}; }, deleteEntry(index) {