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