fix issue where empty values are always on bottom on default ascending columns

This commit is contained in:
Thijs Wenker 2019-01-25 04:02:19 +01:00
parent ae2e85d802
commit 85e26e949b

View file

@ -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;
});