From 13f4a952a4a97223a8a0319c8bf92b5b0feeae57 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 17 Dec 2024 12:54:13 -0600 Subject: Add function to update a preview table. --- .../phenotypes/add-phenotypes-raw-files.html | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html index ef5743e..b0d40fa 100644 --- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html +++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html @@ -320,5 +320,51 @@ event.preventDefault(); $("#txt-file-na").val("- NA N/A"); }); + + var update_preview = (table, filedata, formdata) => { + table.find("thead tr").remove() + table.find(".data-row").remove(); + var linenum = 0; + var tableheader = table.find("thead"); + var tablebody = table.find("tbody"); + var numheadings = 0; + filedata.forEach((line) => { + if(line.startsWith(formdata.comment_char)) { + return false; + } + var row = $("