From f8af750f02ac3df7a1e7fa1ef3944b6eba3486b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Mon, 30 Jan 2023 23:52:27 +0100 Subject: [PATCH] web: fix adding line to table --- public/partdb.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/partdb.js b/public/partdb.js index a9f8d1a..d5e5498 100644 --- a/public/partdb.js +++ b/public/partdb.js @@ -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');