aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-09-08 13:34:41 -0500
committerzsloan2020-09-08 13:34:41 -0500
commit23f2550c758e7ff8602fdb98ae0115b73f0abc29 (patch)
tree47cd3903ff885c8383428f3a442d6a54ab059418
parent87c607251a48c1dc212cca1671f9f2afeae37c54 (diff)
downloadgenenetwork2-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
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js27
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