diff options
author | zsloan | 2022-02-22 22:02:09 +0000 |
---|---|---|
committer | zsloan | 2022-02-26 00:24:10 -0600 |
commit | b1629deb7822b165dbb42de4662e9ab968170e95 (patch) | |
tree | cfa9c1af39429f87b01f632c389810f856cdddc4 | |
parent | 6496f75af521d6801c25de682d2852e14d597fed (diff) | |
download | genenetwork2-b1629deb7822b165dbb42de4662e9ab968170e95.tar.gz |
Add JS initializing DataTables
-rw-r--r-- | wqflask/wqflask/static/new/javascript/partial_correlations.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/wqflask/wqflask/static/new/javascript/partial_correlations.js b/wqflask/wqflask/static/new/javascript/partial_correlations.js index b3a89c5e..030b63f2 100644 --- a/wqflask/wqflask/static/new/javascript/partial_correlations.js +++ b/wqflask/wqflask/static/new/javascript/partial_correlations.js @@ -249,6 +249,8 @@ function display_partial_corr_results(data, status, xhr) { data["results"]["control_traits"], data["results"]["correlations"], data["results"]["method"]); + + initializePcorrTable(data["results"]["dataset_type"]); } function display_partial_corr_error(xhr, status, error) { @@ -285,6 +287,40 @@ function send_data_and_process_results( }); } +function initializePcorrTable(dataType){ + tableId = "part-corr-results-" + dataType.toLowerCase(); + if (dataType == "Publish") { + orderCol = 7; + } else if (dataType == "ProbeSet") { + orderCol = 11; + } else { + orderCol = 6; + } + + $('#' + tableId).dataTable( { + 'drawCallback': function( settings ) { + $('#' + tableId + ' tr').off().on("click", function(event) { + if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') { + var obj =$(this).find('input'); + obj.prop('checked', !obj.is(':checked')); + } + if ($(this).hasClass("selected") && event.target.tagName.toLowerCase() !== 'a'){ + $(this).removeClass("selected") + } else if (event.target.tagName.toLowerCase() !== 'a') { + $(this).addClass("selected") + } + }); + }, + "order": [[orderCol, "asc" ]], + "sDom": "itir", + "iDisplayLength": -1, + "autoWidth": false, + "bDeferRender": true, + "bSortClasses": false, + "paging": false + } ); +} + $("#partial-correlations-form").submit(function(e) { e.preventDefault(); }); |