diff options
author | zsloan | 2020-09-08 13:34:41 -0500 |
---|---|---|
committer | zsloan | 2020-09-08 13:34:41 -0500 |
commit | 23f2550c758e7ff8602fdb98ae0115b73f0abc29 (patch) | |
tree | 47cd3903ff885c8383428f3a442d6a54ab059418 /wqflask | |
parent | 87c607251a48c1dc212cca1671f9f2afeae37c54 (diff) | |
download | genenetwork2-23f2550c758e7ff8602fdb98ae0115b73f0abc29.tar.gz |
Added a sort function (derived from the natural sort import) that always
places N/As at the bottom regardless of search direction
* wqflask/wqflask/static/new/javascript/search_results.js - created
"natural-minus-na" sort
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/search_results.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 16eff345..4e87d67a 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -254,4 +254,31 @@ $(function() { $("#submit_bnw").click(submit_bnw); $("#export_traits").click(export_traits); $('.trait_checkbox, .btn').click(change_buttons); + + + let naturalAsc = $.fn.dataTableExt.oSort["natural-ci-asc"] + let naturalDesc = $.fn.dataTableExt.oSort["natural-ci-desc"] + + function sort_NAs(a, b, sort_function){ + if (a === "N/A" && b === "N/A") { + return 0; + } + if (a === "N/A"){ + return 1 + } + if (b === "N/A") { + return -1; + } + return sort_function(a, b) + } + + $.extend( $.fn.dataTableExt.oSort, { + "natural-minus-na-asc": function (a, b) { + return sort_NAs(a, b, naturalAsc) + }, + "natural-minus-na-desc": function (a, b) { + return sort_NAs(a, b, naturalDesc) + } + }); + });
\ No newline at end of file |