Fix sorting of top-level attachments in attachments column

Also hide the attachments column by default in the select-items dialog
This commit is contained in:
Dan Stillman 2013-03-03 05:16:18 -05:00
parent 98f62c6d3f
commit b0a71467ea
2 changed files with 8 additions and 3 deletions

View file

@ -232,7 +232,7 @@
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol
id="zotero-items-column-hasAttachment"
id="zotero-items-column-hasAttachment" hidden="true"
class="treecol-image"
label="&zotero.tabs.attachments.label;"
src="chrome://zotero/skin/attach-small.png"

View file

@ -1308,10 +1308,15 @@ Zotero.ItemTreeView.prototype.sort = function(itemID)
case 'hasAttachment':
getField = function (row) {
if (!row.ref.isRegularItem()) {
if (row.ref.isAttachment()) {
var state = row.ref.fileExists ? 1 : -1;
}
else if (row.ref.isRegularItem()) {
var state = row.ref.getBestAttachmentState();
}
else {
return 0;
}
var state = row.ref.getBestAttachmentState();
// Make sort order present, missing, empty when ascending
if (state === -1) {
state = 2;