From 975fb0a19feafaf0f2c9a9dbcd88b96a3439196a Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 13 Nov 2020 15:15:10 -0600 Subject: - Added Show/Hide Columns options and included the trait_list.css file which including styling for said options - Changed some column widths to avoid text wrapping --- wqflask/wqflask/templates/correlation_page.html | 73 +++++++++++++++++++++---- 1 file changed, 61 insertions(+), 12 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 6ea86609..3d543c35 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -5,6 +5,7 @@ + {% endblock %} {% block content %} @@ -113,10 +114,38 @@ {% endif %} -
- Show/Hide Columns: +
+ Show/Hide Columns: +
+ + + {% if target_dataset.type == 'ProbeSet' %} + + + + + + + + {% elif target_dataset.type == 'Publish' %} + + + + + + + + + + + {% else %} + + + + + {% endif %}
-
+
@@ -350,7 +379,7 @@ { 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", 'type': "natural-minus-na", - 'width': "40px", + 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] }, @@ -464,7 +493,7 @@ { 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", 'type': "natural-minus-na", - 'width': "40px", + 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] }, @@ -487,7 +516,7 @@ 'data': "additive", 'width': "85px", 'orderSequence': [ "desc", "asc"] - }{% elif dataset.type == 'Geno' %}, + }{% elif target_dataset.type == 'Geno' %}, { 'title': "Location", 'type': "natural-minus-na", @@ -511,7 +540,7 @@ { 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})", 'type': "natural-minus-na", - 'width': "40px", + 'width': "65px", 'data': "sample_p", 'orderSequence': [ "desc", "asc"] }{% endif %} @@ -520,8 +549,12 @@ "targets": 0, "orderable": false } ], + {% if target_dataset.type == 'Geno' %} + "order": [[6, "asc" ]], + {% else %} "order": [[9, "asc" ]], - "sDom": "Bitir", + {% endif %} + "sDom": "itir", "autoWidth": true, "bSortClasses": false, "scrollY": "50vh", @@ -529,16 +562,32 @@ "scrollCollapse": true } - the_table = $('#trait_table').DataTable(table_conf); + trait_table = $('#trait_table').DataTable(table_conf); - the_table.on( 'order.dt search.dt draw.dt', function () { - the_table.column(1, {search:'applied', order:'applied'}).nodes().each( function (cell, i) { + trait_table.on( 'order.dt search.dt draw.dt', function () { + trait_table.column(1, {search:'applied', order:'applied'}).nodes().each( function (cell, i) { cell.innerHTML = i+1; } ); } ).draw(); console.timeEnd("Creating table"); + $('.toggle-vis').on( 'click', function (e) { + e.preventDefault(); + + // Get the column API object + var column = trait_table.column( $(this).attr('data-column') ); + + // Toggle the visibility + column.visible( ! column.visible() ); + + if (column.visible()){ + $(this).removeClass("active"); + } else { + $(this).addClass("active"); + } + } ); + submit_special = function(url) { $("#correlation_form").attr("action", url); return $("#correlation_form").submit(); @@ -555,7 +604,7 @@ $("#select_traits").click(function() { console.log("redrawing") - the_table.draw(); + trait_table.draw(); }); }); -- cgit v1.2.3