diff options
author | zsloan | 2020-09-10 14:54:57 -0500 |
---|---|---|
committer | zsloan | 2020-09-10 14:54:57 -0500 |
commit | 03240c4d22e894b977f7a1a2204a32408245c470 (patch) | |
tree | ddb7b936e635c0645d810668cc60bce968454b4a /wqflask | |
parent | 657ab53bef4fc767fdc549f004153a7910b45bd0 (diff) | |
download | genenetwork2-03240c4d22e894b977f7a1a2204a32408245c470.tar.gz |
Modified "natural-minus-na" sort function to treat an array of values
as equivalent to "N/A" (since different tables sometimes include other
values that imply there's no value) and applied it to some extra columns
in the Interval Analyst table
* wqflask/wqflask/static/new/javascript/search_results.js - Modified
sort_NAs function to take an array of "N/A"-equivalent values instead of
just comparing against the string "N/A"
* wqflask/wqflask/templates/mapping_results.html - Applied
"natural-minus-na" sort method to several columns that include "--" in
the Interval Analyst table
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/search_results.js | 8 | ||||
-rw-r--r-- | wqflask/wqflask/templates/mapping_results.html | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index b696dc4d..685d6291 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -259,14 +259,16 @@ $(function() { let naturalAsc = $.fn.dataTableExt.oSort["natural-ci-asc"] let naturalDesc = $.fn.dataTableExt.oSort["natural-ci-desc"] + let na_equivalent_vals = ["N/A", "--", ""]; //ZS: Since there are multiple values that should be treated the same as N/A + function sort_NAs(a, b, sort_function){ - if (a === "N/A" && b === "N/A") { + if ( na_equivalent_vals.includes(a) && na_equivalent_vals.includes(b)) { return 0; } - if (a === "N/A"){ + if (na_equivalent_vals.includes(a)){ return 1 } - if (b === "N/A") { + if (na_equivalent_vals.includes(b)) { return -1; } return sort_function(a, b) diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 9c170494..4ea7fa07 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -402,9 +402,9 @@ { "type": "natural" , "orderDataType": "dom-inner-text" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" , "orderDataType": "dom-inner-text" }, + { "type": "natural-minus-na" }, + { "type": "natural-minus-na" }, + { "type": "natural-minus-na" , "orderDataType": "dom-inner-text" }, { "type": "natural" } ], "columnDefs": [ { |