Käyttöliittymä luokkien poistamiselle

This commit is contained in:
Juhani Krekelä 2024-05-19 14:24:26 +03:00
parent 55532c2e35
commit c94bc35573
1 changed files with 10 additions and 1 deletions

View File

@ -51,6 +51,15 @@ function vertaa(a, b) {
function luoLuokka(id, nimi) {
const li = document.createElement('li');
li.id = `luokka-${id}`;
li.textContent = nimi;
const poistoPainike = document.createElement('input');
poistoPainike.type = 'button';
poistoPainike.value = '-';
poistoPainike.addEventListener('click', () => {
suorita(_tietokanta.transaktio((t) => {
t.poista(taulut.luokat, id);
}));
});
li.appendChild(poistoPainike);
li.appendChild(document.createTextNode(nimi));
return li;
}