Attachment order

This discussion was created from comments split from: Attachment order (and reordering).
  • This is an old thread, but I started having an issue with the attachment order on Zotero 5.0.94

    Is it just me or a common bug?
  • This sounds like some sort of misunderstanding, but you'd have to explain what the problem is you're experiencing for us to say more.

    There are no known bugs related to ordering. Attachments are ordered by the attachment title by default. There's an 'sortAttachmentsChronologically' preference that you can toggle on in the Config Editor in the Advanced pane of the preferences.
  • edited February 27, 2021
    Hi, dstillman, thanks for your reply!

    Yes, since I started using Zotero in 2011 that has been the default behaviour, but now for some reason it's changed, as you can see here:

    The option "extensions.zotero.sortAttachmentsChronologically" is set to "false".
  • I'm not sure what that screenshot is meant to show. That shows them sorting correctly by title.
  • edited February 27, 2021
    OK, maybe it I'm getting this wrong.

    Before I could sort attachments by adding a number at the beginning (0, 1, 2, and so on). Is that not considered part of the "title" now?

    I've just updated the screenshot to show that the order is not alphabetical in either way: "0, 3, 8, 7" or "F, (The) D, S, C".
  • edited February 27, 2021
    Well, your first screenshot showed 0, 3, 8, so that was sorted correctly. (It also happened to be sorting alphabetically after that, though that was irrelevant. "The" is ignored for sorting in the items list.)

    0, 3, 8, 7 is wrong, though. Does that persist after restarting Zotero?

    To be clear, this is about child attachments to an item? If so, can you show that in the screenshot?
  • Updated as requested!

    Yes, child attachments to an item.
  • Does this persist after restarting Zotero?
  • Yes, and on two different laptops. Both running on Linux (Ubuntu 20.04). I could try to see what happens on Windows 10 if that helps.
  • Can you select the parent item, paste this into Tools → Developer → Run JavaScript, and tell me the result?

    var rows = ZoteroPane.getSelectedItems()[0].getAttachments().map(x => Zotero.Items.get(x)); var collation = Zotero.getLocaleCollation(); rows.sort((a, b) => collation.compareString(1, a.getField('title'), b.getField('title'))); Zotero.Prefs.get('sortAttachmentsChronologically') + "\n" + JSON.stringify( => x.getField('title')))
  • I get the alphabetical order there:

    ["0 - Front Matter.pdf","3 - The Decay of Lying.pdf","7 - The Critic as Artist.pdf","8 - The Soul of Man Under Socialism.pdf"]
  • edited February 27, 2021
    Does it make a difference what column you're sorting the items list by?
  • If you click the attachment title in the right-hand pane and rename something to use a different number (without renaming the associated file), does the order change?
  • Can you reproduce this if you create a new empty item and add some linked-URL attachments below it with different names?
  • I can reproduce this with link attachments in a new parent item. They are displayed chronologically.

    Notes however work normally (i.e. are displayed alphabetically, regardless of when they were added or edited).
  • I'm having this same issue. The only difference I have is that when I run the javascript dstillman suggested on Feb 27 I get imperfect alphabetisation. Notes do indeed alphabetise. I toggled the sort attachments chronologically on, then restarted, set it to off, restarted, but it didn't help. Using on a Mac
  • I have the same issue, when I attached aaa.pdf, 111.pdf, bbb.pdf, 000.pdf, it showed the order I added, extensions.zotero.sortAttachmentsChronologically was set as false.
  • The zotero and Win 10 has been restarted, but the order did not change.
  • Same issue here. Windows 10 64 bits running latest Zotero version.
    Plugins: Zotfile, DOI, BibTex, Mdnotes, Zutilo.
Sign In or Register to comment.