diff options
author | uditgulati | 2020-07-10 10:30:04 -0500 |
---|---|---|
committer | uditgulati | 2020-11-01 05:11:00 -0600 |
commit | f99b69155d35900a75c000fbb79f6bcfb3fa6ff1 (patch) | |
tree | f48b6577b57440471840d4497efb3a30e8a66f0e | |
parent | 7a4068d6d46d923c30316887e1d20f2fa6caa859 (diff) | |
download | genenetwork2-f99b69155d35900a75c000fbb79f6bcfb3fa6ff1.tar.gz |
export only checked rows to csv; update csv file name
-rw-r--r-- | wqflask/wqflask/templates/snp_browser.html | 14 |
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); |