From 5479718ce714a22eb3dbf795656cc69e66a8baee Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 13 May 2015 17:15:31 +0000 Subject: Fixed sorting on the trait page so that x values always appear at the bottom --- wqflask/wqflask/templates/show_trait.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index d6f22f41..c646bf9f 100755 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -146,7 +146,7 @@ function getValue(x) { if (x.indexOf('input') >= 0) { if ($(x).val() == 'x') { - return 0 + return 'x' } else { return parseFloat($(x).val()); @@ -164,7 +164,16 @@ jQuery.fn.dataTableExt.oSort['cust-txt-desc'] = function (a, b) { var x = getValue(a); var y = getValue(b); - return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + + if (x == 'x') { + return 1; + } + else if (y == 'x') { + return -1; + } + else { + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + } }; $(document).ready( function () { -- cgit v1.2.3