I am trying to group nodes by taxonomy term of a vocabulary, each node can have more than one taxonomy term from the vocabulary and should be displayed as follows using Views:

Term 1
--- Node 1
--- Node 3
--- Node 5

Term 2
--- Node 1
--- Node 2
--- Node 4
--- Node 5

I have tried grouping by the taxonomy term field and also applying contextual filters but can't make it output as shown above and get different results each time. I either get a List on Nodes with the terms each one has assigned to it:

Node 1
-- Term 1
-- Term 2

Node 2
-- Term 2

Node 3
-- Term 1

etc....

Or groups of terms with the nodes assigned eg;

Term 1
-- Node 3

Term 2
-- Node 2
-- Node 4

Term 1, Term 2
-- Node 1
-- Node 5

I though this would be easy to achieve, but after 3 hours of trial and error and searching, I am at a total loss and can't find a way to do it.

I'm open to suggestions on how to do this if Views is not the best tool, so any help gratefully received. Thanks

Comments

ahillio’s picture

I think what you want, instead of grouping or contextual filters is "sort criteria". Does adding that term reference field as your sort criteria do what you're looking for?

stokeboy0’s picture

All working now thanks to your "sort criteria" suggestion. Here is what I did to get the required results:

I tried "sort criteria" as suggested but initially got similar results. So I tried "sort criteria" with Aggregation set to Yes and Grouping with the Term field and I am now getting the correct output, exactly how I need it - hoorah!

Thank you very much for your push in the right direction, wouldn't have worked it out without your assistance.