web: fix adding line to table

This commit is contained in:
King Kévin 2023-01-30 23:52:27 +01:00
parent 682e0cd9aa
commit f8af750f02
1 changed files with 4 additions and 3 deletions

View File

@ -113,12 +113,13 @@ function select_part()
for (const table of tables) {
const tbody = document.getElementById(table);
tbody.innerHTML = null;
const content = part[table].slice();
if ("components" == table) {
part[table].push({name: "", quantity: ""}); // empty field to add
content.push({name: "", quantity: ""}); // empty field to add
} else {
part[table].push({name: "", value: ""}); // empty field to add
content.push({name: "", value: ""}); // empty field to add
}
for (const row of part[table]) {
for (const row of content) {
const tr = document.createElement('tr');
let td = document.createElement('td');
let input = document.createElement('input');