This commit is contained in:
parent
43583fb7f3
commit
41010b8a7b
@ -40,6 +40,7 @@
|
|||||||
// Beispielsweise das Formular zurücksetzen
|
// Beispielsweise das Formular zurücksetzen
|
||||||
form.reset();
|
form.reset();
|
||||||
updateSubmitButtonState();
|
updateSubmitButtonState();
|
||||||
|
loadDatabaseEntries();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('Fehler:', error);
|
console.error('Fehler:', error);
|
||||||
});
|
});
|
||||||
@ -98,7 +99,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateDeleteButtonState() {
|
function updateDeleteButtonState() {
|
||||||
const selectedRows = document.querySelectorAll('#nutrition-table.selected').length;
|
const selectedRows = document.querySelectorAll('#database-nutrition-table .selected').length;
|
||||||
const deleteButton = document.getElementById('delete-row-button');
|
const deleteButton = document.getElementById('delete-row-button');
|
||||||
deleteButton.disabled = selectedRows === 0;
|
deleteButton.disabled = selectedRows === 0;
|
||||||
if (selectedRows === 0) {
|
if (selectedRows === 0) {
|
||||||
@ -107,11 +108,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function loadDatabaseEntries() {
|
function loadDatabaseEntries() {
|
||||||
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
|
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
|
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
|
||||||
|
tableBody.innerHTML = '';
|
||||||
data.forEach(entry => {
|
data.forEach(entry => {
|
||||||
const row = tableBody.insertRow();
|
const row = tableBody.insertRow();
|
||||||
row.insertCell(0).innerHTML = entry.food;
|
row.insertCell(0).innerHTML = entry.food;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user