diff options
author | zsloan | 2020-02-04 16:14:53 -0600 |
---|---|---|
committer | zsloan | 2020-02-04 16:14:53 -0600 |
commit | 7464ce21b5d2577d35e4df1814e57b874ee95590 (patch) | |
tree | 790fd64c996410836495879eb9b3bfed691de367 | |
parent | 85757b2917f4e2a95f3ffe2c17c607f1c3d8c89d (diff) | |
download | genenetwork2-7464ce21b5d2577d35e4df1814e57b874ee95590.tar.gz |
Fixed issue where you couldn't download global search table results
-rw-r--r-- | wqflask/wqflask/gsearch.py | 25 | ||||
-rw-r--r-- | wqflask/wqflask/templates/gsearch_gene.html | 14 | ||||
-rw-r--r-- | wqflask/wqflask/templates/gsearch_pheno.html | 11 |
3 files changed, 50 insertions, 0 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 53e5f2b7..9e06abfe 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -104,6 +104,20 @@ class GSearch(object): self.trait_count = len(trait_list) self.trait_list = json.dumps(trait_list) + self.header_fields = ['Index', + 'Record', + 'Species', + 'Group', + 'Tissue', + 'Dataset', + 'Symbol', + 'Description', + 'Location', + 'Mean', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + elif self.type == "phenotype": sql = """ SELECT @@ -194,3 +208,14 @@ class GSearch(object): self.trait_count = len(trait_list) self.trait_list = json.dumps(trait_list) + + self.header_fields = ['Index', + 'Species', + 'Group', + 'Record', + 'Description', + 'Authors', + 'Year', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 85127e99..2d5d303c 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -24,6 +24,7 @@ <input type="text" id="searchbox" class="form-control" style="width: 180px; display: inline;" placeholder="Search This Table For ..."> <input type="text" id="select_top" class="form-control" style="width: 120px; display: inline;" placeholder="Select Top ..."> <form id="export_form" method="POST" action="/export_traits_csv" style="display: inline;"> + <input type="hidden" name="headers" id="headers" value="{% for field in header_fields %}{{ field }},{% endfor %}"> <input type="hidden" name="database_name" id="database_name" value="None"> <input type="hidden" name="export_data" id="export_data" value=""> <button class="btn btn-default" id="export_traits">Download</button> @@ -141,6 +142,19 @@ $('td', row).eq(8).text($('td', row).eq(8).text() + '...') } $('td', row).slice(10,14).attr("align", "right"); + $('td', row).eq(1).attr('data-export', $('td', row).eq(1).text()); + $('td', row).eq(2).attr('data-export', $('td', row).eq(2).text()); + $('td', row).eq(3).attr('data-export', $('td', row).eq(3).text()); + $('td', row).eq(4).attr('data-export', $('td', row).eq(4).text()); + $('td', row).eq(5).attr('data-export', $('td', row).eq(5).text()); + $('td', row).eq(6).attr('data-export', $('td', row).eq(6).text()); + $('td', row).eq(7).attr('data-export', $('td', row).eq(7).text()); + $('td', row).eq(8).attr('data-export', $('td', row).eq(8).text()); + $('td', row).eq(9).attr('data-export', $('td', row).eq(9).text()); + $('td', row).eq(10).attr('data-export', $('td', row).eq(10).text()); + $('td', row).eq(11).attr('data-export', $('td', row).eq(11).text()); + $('td', row).eq(12).attr('data-export', $('td', row).eq(12).text()); + $('td', row).eq(13).attr('data-export', $('td', row).eq(13).text()); }, 'data': the_rows, 'columns': [ diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index bc88a76e..c4e132d8 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -24,6 +24,7 @@ <input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ..."> <input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ..."> <form id="export_form" method="POST" action="/export_traits_csv" style="display: inline;"> + <input type="hidden" name="headers" id="headers" value="{% for field in header_fields %}{{ field }},{% endfor %}"> <input type="hidden" name="database_name" id="database_name" value="None"> <input type="hidden" name="export_data" id="export_data" value=""> <button class="btn btn-default" id="export_traits">Download CSV</button> @@ -131,6 +132,16 @@ $('td', row).eq(6).text($('td', row).eq(6).text() + '...') } $('td', row).slice(8,11).attr("align", "right"); + $('td', row).eq(1).attr('data-export', $('td', row).eq(1).text()); + $('td', row).eq(2).attr('data-export', $('td', row).eq(2).text()); + $('td', row).eq(3).attr('data-export', $('td', row).eq(3).text()); + $('td', row).eq(4).attr('data-export', $('td', row).eq(4).text()); + $('td', row).eq(5).attr('data-export', $('td', row).eq(5).text()); + $('td', row).eq(6).attr('data-export', $('td', row).eq(6).text()); + $('td', row).eq(7).attr('data-export', $('td', row).eq(7).text()); + $('td', row).eq(8).attr('data-export', $('td', row).eq(8).text()); + $('td', row).eq(9).attr('data-export', $('td', row).eq(9).text()); + $('td', row).eq(10).attr('data-export', $('td', row).eq(10).text()); }, 'data': the_rows, 'columns': [ |