From 5dbeea80df5dc5c6d9fae026cf2d78931493cc78 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Mon, 15 Jul 2024 11:39:05 +0200 Subject: [PATCH] reload Tables correctly on student change --- public/js/components/Betriebsmittel/Betriebsmittel.js | 10 ++++++---- public/js/components/Notiz/Notiz.js | 11 ++++++++--- .../Studentenverwaltung/Details/Prestudent/History.js | 10 +++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/public/js/components/Betriebsmittel/Betriebsmittel.js b/public/js/components/Betriebsmittel/Betriebsmittel.js index 211455dbf..a3acb6673 100644 --- a/public/js/components/Betriebsmittel/Betriebsmittel.js +++ b/public/js/components/Betriebsmittel/Betriebsmittel.js @@ -36,9 +36,11 @@ export default { tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: this.endpoint.getAllBetriebsmittel, - ajaxParams: { - type: this.typeId, - id: this.id + ajaxParams: () => { + return { + type: this.typeId, + id: this.id + }; }, ajaxResponse: (url, params, response) => response.data, columns: [ @@ -149,7 +151,7 @@ export default { }, watch: { id() { - this.$refs.table.tabulator.setData('dummy', {type: this.typeId, id: this.id}); + this.$refs.table.reloadTable(); } }, methods: { diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index f766b96eb..18d483985 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -49,9 +49,11 @@ export default { tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: this.endpoint.getNotizen, - ajaxParams: { - id: this.id, - type: this.typeId + ajaxParams: () => { + return { + id: this.id, + type: this.typeId + }; }, ajaxResponse: (url, params, response) => response.data, columns: [ @@ -479,6 +481,9 @@ export default { } }, deep: true + }, + id() { + this.reload(); } }, beforeDestroy() { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js index 31ca8e894..ac071d306 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js @@ -9,7 +9,6 @@ export default{ prestudentId: Number }, data() { - let prestudent_id = this.prestudentId; return { tabulatorOptions: { ajaxURL: 'api/frontend/v1/stv/Prestudent/getHistoryPrestudents/' + this.personId, @@ -26,13 +25,13 @@ export default{ {title:"Status", field:"status"}, {title:"PrestudentId", field:"prestudent_id", visible:false} ], - rowFormatter(row) { + rowFormatter: row => { const rowData = row.getData(); const element = row.getElement(); if (["Abgewiesener","Abbrecher","Absolvent"].includes(rowData.status_kurzbz)) { element.classList.add('disabled'); } - if (rowData.prestudent_id == prestudent_id) { + if (rowData.prestudent_id == this.prestudentId) { element.classList.add('fw-bold'); } }, @@ -62,6 +61,11 @@ export default{ ] } }, + watch: { + personId() { + this.$refs.table.tabulator.setData('api/frontend/v1/stv/Prestudent/getHistoryPrestudents/' + this.personId); + } + }, template: `