From 85e26e949b5b08b878d3764fb4513e94acf6c8d6 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 25 Jan 2019 04:02:19 +0100 Subject: [PATCH] fix issue where empty values are always on bottom on default ascending columns --- scripts/system/html/js/entityList.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index cf6105fb71..f059b91e81 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -672,17 +672,14 @@ function loaded() { let valueB = entityB[currentSortColumnID]; if (valueA === valueB) { - if (entityA.id < entityB.id) { - return -1; - } - return 1; + return entityA.id < entityB.id ? -1 : 1; } if (isNullOrEmpty(valueA)) { - return (isDefaultSort && isAscendingSort) ? 1 : -1; + return (isDefaultSort ? 1 : -1) * (isAscendingSort ? 1 : -1); } if (isNullOrEmpty(valueB)) { - return (isDefaultSort && isAscendingSort) ? -1 : 1; + return (isDefaultSort ? -1 : 1) * (isAscendingSort ? 1 : -1); } return valueA < valueB ? -1 : 1; });