From 8c1c7e3c956df3f6e3a2df4f5cca30aa1e1072d4 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Thu, 8 May 2025 00:36:45 +0200 Subject: [PATCH] now using tbody instead of table --- public/js/socket.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/public/js/socket.js b/public/js/socket.js index af3f8ae..f6d3a26 100644 --- a/public/js/socket.js +++ b/public/js/socket.js @@ -28,19 +28,16 @@ socket.on("started-processing", () => { }); socket.on("ended-processing", (data) => { + progressContainer.style.display = "none"; resultsContainer.style.display = "block"; // empty the table besides the header of the table and fill the table. the data is of form id: // {"proposed comment": "bla bla bla", "bleu score": 0.2} - const table = resultsContainer.querySelector("table"); - - // remove all the rows besides the table header - while (table.rows.length > 1) { - table.deleteRow(1); - } + const tbody = resultsContainer.querySelector("table tbody"); + tbody.innerHTML = ""; Object.entries(data).forEach(([id, info]) => { - const row = table.insertRow(); // create a new row + const row = tbody.insertRow(); // create a new row const idCell = row.insertCell(); // cell 1: id const commentCell = row.insertCell(); // cell 2: proposed comment const scoreCell = row.insertCell(); // cell 3: bleu score