aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruditgulati2020-07-10 10:30:04 -0500
committeruditgulati2020-11-01 05:11:00 -0600
commitf99b69155d35900a75c000fbb79f6bcfb3fa6ff1 (patch)
treef48b6577b57440471840d4497efb3a30e8a66f0e
parent7a4068d6d46d923c30316887e1d20f2fa6caa859 (diff)
downloadgenenetwork2-f99b69155d35900a75c000fbb79f6bcfb3fa6ff1.tar.gz
export only checked rows to csv; update csv file name
-rw-r--r--wqflask/wqflask/templates/snp_browser.html14
1 files changed, 8 insertions, 6 deletions
diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html
index 284b55c5..83606804 100644
--- a/wqflask/wqflask/templates/snp_browser.html
+++ b/wqflask/wqflask/templates/snp_browser.html
@@ -531,25 +531,27 @@
var headers = [];
var col_header = rows[0].querySelectorAll("th");
- console.log(col_header.length);
for(var i = 1; i < col_header.length; i++) {
- console.log(col_header[i].getAttribute("name"));
headers.push(col_header[i].getAttribute("name"));
}
csv.push(headers.join(","));
for (var i = 1; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll("td");
+ var checkBox = rows[i].querySelector("input");
+ console.log(checkBox);
- for (var j = 1; j < cols.length; j++)
- row.push(cols[j].innerText);
+ if(checkBox.checked == true) {
+ for (var j = 1; j < cols.length; j++)
+ row.push(cols[j].innerText);
- csv.push(row.join(","));
+ csv.push(row.join(","));
+ }
}
var csvFile = new Blob([csv.join("\n")], {type: "text/csv"});
var downloadLink = document.createElement("a");
- downloadLink.download = "hello.csv";
+ downloadLink.download = "variant_data.csv";
downloadLink.href = window.URL.createObjectURL(csvFile);
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);