mirror of
https://github.com/karma-riuk/crab-webapp.git
synced 2025-07-05 14:18:12 +02:00
now using tbody instead of table
This commit is contained in:
@ -28,19 +28,16 @@ socket.on("started-processing", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on("ended-processing", (data) => {
|
socket.on("ended-processing", (data) => {
|
||||||
|
progressContainer.style.display = "none";
|
||||||
resultsContainer.style.display = "block";
|
resultsContainer.style.display = "block";
|
||||||
// empty the table besides the header of the table and fill the table. the data is of form id:
|
// 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}
|
// {"proposed comment": "bla bla bla", "bleu score": 0.2}
|
||||||
|
|
||||||
const table = resultsContainer.querySelector("table");
|
const tbody = resultsContainer.querySelector("table tbody");
|
||||||
|
tbody.innerHTML = "";
|
||||||
// remove all the rows besides the table header
|
|
||||||
while (table.rows.length > 1) {
|
|
||||||
table.deleteRow(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.entries(data).forEach(([id, info]) => {
|
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 idCell = row.insertCell(); // cell 1: id
|
||||||
const commentCell = row.insertCell(); // cell 2: proposed comment
|
const commentCell = row.insertCell(); // cell 2: proposed comment
|
||||||
const scoreCell = row.insertCell(); // cell 3: bleu score
|
const scoreCell = row.insertCell(); // cell 3: bleu score
|
||||||
|
Reference in New Issue
Block a user