Sort empty rows last for Date/Year columns when descending
Date columns start in descending order, so put empty rows at end Also remove a seemingly unnecessary exception for Title when not the primary sort and just always sort it with empty rows first
This commit is contained in:
parent
e25ec0d981
commit
9dc8995ba8
1 changed files with 8 additions and 14 deletions
|
@ -1242,20 +1242,14 @@ var ItemTree = class ItemTree extends LibraryTree {
|
||||||
? `for ${itemIDs.length} ` + Zotero.Utilities.pluralize(itemIDs.length, ['item', 'items'])
|
? `for ${itemIDs.length} ` + Zotero.Utilities.pluralize(itemIDs.length, ['item', 'items'])
|
||||||
: ""));
|
: ""));
|
||||||
|
|
||||||
// Set whether rows with empty values should be displayed last,
|
// Set whether rows with empty values should sort at the beginning
|
||||||
// which may be different for primary and secondary sorting.
|
var emptyFirst = {
|
||||||
var emptyFirst = {};
|
title: true,
|
||||||
switch (primaryField) {
|
|
||||||
case 'title':
|
// Date columns start descending, so put empty rows at end
|
||||||
emptyFirst.title = true;
|
date: true,
|
||||||
break;
|
year: true,
|
||||||
|
};
|
||||||
// When sorting by title we want empty titles at the top, but if not
|
|
||||||
// sorting by title, empty titles should sort to the bottom so that new
|
|
||||||
// empty items don't get sorted to the middle of the items list.
|
|
||||||
default:
|
|
||||||
emptyFirst.title = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache primary values while sorting, since base-field-mapped getField()
|
// Cache primary values while sorting, since base-field-mapped getField()
|
||||||
// calls are relatively expensive
|
// calls are relatively expensive
|
||||||
|
|
Loading…
Reference in a new issue