From d38f4c6c2176d935bcb4f235fb4eee8b3ad703c2 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 1 Mar 2016 20:57:11 +0000 Subject: Fixed csv download and removed non-working "Download Table" button for collections list, collection view, gene/pheno global search, and regular search Not sure what the best way to determine the filename is, so just using "search_results" or "collection_list" for now In future I want to replace the default csv download button by attaching its function to the previous "Download Table" button --- wqflask/wqflask/templates/collections/list.html | 15 ++++++++++- wqflask/wqflask/templates/collections/view.html | 24 ++++++++++++++--- wqflask/wqflask/templates/gsearch_gene.html | 19 ++++++++++++-- wqflask/wqflask/templates/gsearch_pheno.html | 19 ++++++++++++-- wqflask/wqflask/templates/search_result_page.html | 32 ++++++++++++++++++++--- 5 files changed, 97 insertions(+), 12 deletions(-) diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 52106eae..0e7612aa 100755 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -4,6 +4,7 @@ + {% endblock %} {% block content %} @@ -55,6 +56,10 @@ {% block js %} + + + + @@ -62,7 +67,15 @@ + + + + @@ -148,6 +154,7 @@ console.time("Creating table"); $('#trait_table').dataTable( { "columns": [ + { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural", @@ -161,7 +168,18 @@ "width": "15%" }, { "type": "natural" } ], - "sDom": "ZRtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'collection', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8] + } + } + ], + "sDom": "ZRBtir", "iDisplayLength": -1, "autoWidth": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 0a1839a1..7cc9a1bd 100755 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -6,6 +6,7 @@ + {% endblock %} {% block content %} @@ -20,7 +21,6 @@ - @@ -77,6 +77,10 @@ + + + + @@ -169,7 +173,18 @@ { "type": "cust-txt" } ], "order": [[ 1, "asc" ]], - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] + } + } + ], + "sDom": "RZBtir", "autoWidth": false, "bLengthChange": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 2527bebf..0bdc4f4e 100755 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -4,6 +4,7 @@ + {% endblock %} @@ -20,7 +21,6 @@ -
@@ -70,6 +70,10 @@ + + + + @@ -137,7 +141,18 @@ { "type": "natural" } ], "order": [[ 1, "asc" ]], - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + } + } + ], + "sDom": "RZBtir", "autoWidth": false, "bLengthChange": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 02365b1d..ff3e04bb 100755 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -167,7 +167,7 @@ - +