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');