From 71ba75d2f5f2cc4be254887efc806d82498cbcbe Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 8 Jun 2018 17:11:55 +0100 Subject: [PATCH] Fix - sorting: Absolute sorting didn't consider the case of the two items being compared both being in the "always" sorting categories. - Thanks to awelch for this fix! --- sorting/absolute.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sorting/absolute.js b/sorting/absolute.js index cc0ce0a..35587b3 100644 --- a/sorting/absolute.js +++ b/sorting/absolute.js @@ -98,7 +98,13 @@ var _setup = function ( values ) { // Ascending ordering method o.asc = function ( a, b, isNumber ) { - if ( o.alwaysTop[ a ] || o.alwaysBottom[ b ] ) { + if ( o.alwaysTop[ a ] && o.alwaysTop[ b ] ) { + return 0; + } + else if ( o.alwaysBottom[ a ] && o.alwaysBottom[ b ] ) { + return 0; + } + else if ( o.alwaysTop[ a ] || o.alwaysBottom[ b ] ) { return -1; } else if ( o.alwaysBottom[ a ] || o.alwaysTop[ b ] ) { @@ -120,7 +126,13 @@ var _setup = function ( values ) { // Descending ordering method o.desc = function ( a, b, isNumber ) { - if ( o.alwaysTop[ a ] || o.alwaysBottom[ b ] ) { + if ( o.alwaysTop[ a ] && o.alwaysTop[ b ] ) { + return 0; + } + else if ( o.alwaysBottom[ a ] && o.alwaysBottom[ b ] ) { + return 0; + } + else if ( o.alwaysTop[ a ] || o.alwaysBottom[ b ] ) { return -1; } else if ( o.alwaysBottom[ a ] || o.alwaysTop[ b ] ) {