1

The setup:

A view that lists out nodes containing study abroad Program information. Its format is Unformatted List. There is a Grouping field of Country (which is a field on the Program content type). The list is sorted by Country (asc) and then Program title (asc).

There are exposed filters (via Better Exposed Filters) for a few of the fields from the Program content type... one of which is Country. These filters are exposed in a block that's included on the view page.

The Problem:

When you perform a search via the exposed filter block with multiple Countries selected, the sort order seems arbitrary. The grouping (by Country) works, but the Countries are listed out of order... not alphabetical asc or desc... just arbitrary.

Worth mentioning: any other search using any of the other exposed filters, but not selecting any Country values, works fine.

What's going on here? Why does sort get wacky when searching by Country... which, coincidentally or not, is also the grouping field?


View settings

10
  • Do you have the two sort criteria in the right order? With Country first and Program second? Or is Country is an entity reference to a node/taxonomy? I once had an odd case were sorting didn't work unless I used the title of the actual node via relationship. (It was always using the id for sorting for some reason and not the actual title.)
    – Zuzuesque
    Jul 8 '16 at 15:52
  • Sorting order is correct: 1. Country (asc), 2. Title (asc). The countries are not terms, they're just values in a select list (I forget why I set it up that way), so there are no relationships needed.
    – Sam
    Jul 8 '16 at 16:00
  • Taking into account all information you listed, it should be working. I have multiple views with grouped results where the groups are listed alphabetically, though never through a select list. Is the select list one with numerical index maybe? It would use the index for sorting then, not the title.
    – Zuzuesque
    Jul 8 '16 at 16:17
  • @Zuzuesque Ah... that's interesting... using the index instead of title... I hadn't thought of that. Just checked, the country name is both the key and value. Ex.: Argentina|Argentina; Brazil|Brazil.
    – Sam
    Jul 8 '16 at 17:45
  • @Zuzuesque Also, I should have mentioned, I am using Better Exposed Filters here. Just update the question to reflect that.
    – Sam
    Jul 8 '16 at 17:55
2

It seems that disabling "Reduce duplicates" on the exposed filter of the grouping field will bring the sort back in order. So, in this case, unchecking "Reduce duplicates" on the exposed filter, Country (which is also the grouping field) did the trick.

settings screen

2
  • To be honest, I'm not exactly sure why reducing duplicates was breaking the sort order. For completeness, I'd like to update the answer with an explanation if anyone has one... or I'd be happy to concede to a more thorough answer. (Funny that I found the answer myself only after starting a bounty. Well, at least it's fixed!)
    – Sam
    Jul 15 '16 at 18:30
  • 1
    Good to know. Thanks for answering your own question.. I wish more people would! Jul 15 '16 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.