Fixed sorting
This commit is contained in:
parent
3161bdaa05
commit
af96239b9a
@ -1447,12 +1447,13 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
// Wraps the orderBy filter. But puts ("", null, undefined) last.
|
// Wraps the orderBy filter. But puts ("", null, undefined) last.
|
||||||
.filter('orderByEmptyLast', [
|
.filter('orderByEmptyLast', [
|
||||||
'$filter',
|
'$filter',
|
||||||
function ($filter) {
|
'$parse',
|
||||||
|
function ($filter, $parse) {
|
||||||
return function (array, sortPredicate, reverseOrder, compareFn) {
|
return function (array, sortPredicate, reverseOrder, compareFn) {
|
||||||
|
var parsed = $parse(sortPredicate);
|
||||||
var falsyItems = [];
|
var falsyItems = [];
|
||||||
var truthyItems = _.filter(array, function (item) {
|
var truthyItems = _.filter(array, function (item) {
|
||||||
var falsy = item[sortPredicate] === void 0 ||
|
var falsy = parsed(item) === void 0 || parsed(item) === null || parsed(item) === '';
|
||||||
item[sortPredicate] === null || item[sortPredicate] === '';
|
|
||||||
if (falsy) {
|
if (falsy) {
|
||||||
falsyItems.push(item);
|
falsyItems.push(item);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user