I am trying to create a glossary view but the one that Views provides uses the first letter of the node's title. I need it to use the first letter of a field named Artist in my content type. I've tried making a new Contextual Filter and match it up with the one provided by the glossary view but the Glossary mode is not even an option, which I find to be very odd. Anyone have any ideas? :-/
1 Answers
You're doing the correct thing by copying the existing Contextual Filter, for both Page and Attachment displays. Your main problem is figuring out why the Glossary mode option doesn't appear for your field. With Views 7.x-3.3, it should do if your Artist field is a Text type but I suspect yours is actually a List or Term reference.
If it's a List (text) field: upgrade to Views 7.x-3.x-dev and the glossary mode option will be available.
If it's a Term reference field: add a Relationship for the Term or "Taxonomy terms on node" and then you will be able to use the Term Name as a glossary argument.
If it's a Node reference field: add a Relationship for your node reference field and check "Require this relationship". Then update the Content: Title contextual filter in both the Page and Attachment displays to use this relationship. This tells the view that the filter should be based on the title of the related node instead of the parent node.

- 12,012
- 3
- 28
- 33
-
Unfortunately the field is a Node Reference. It is referencing 2 content types: Artist & Band. Each of those 2 types has the Title field set as the Artist or Band name. I added a "Taxonomy terms on node" relationship and I do see the Glossary option now. However, they are not being organized by letter. I get one category that says Uncategorized that has 1,245 nodes in it. :( Not sure what I'm doing wrong. This is my first adventure into contextual filters and relationships in Views. – Dustin Jul 16 '12 at 13:30
-
Ah! I've updated my answer to include handling node reference fields. I hope it makes sense. You should remove that "Taxonomy terms on node" relationship first, as it doesn't apply in your case. – scronide Jul 16 '12 at 18:36
-
Awesome! I got it now. I am having one other small issue though. For some reason there are no results being displayed under the alphabet links. I do get results when I browse to example.com/glossary/all and when I click on a letter. I noticed the results disappeared when I added a filter to only grab node that had a specific taxonomy term. Maybe I need to only apply the filter on just the page or just the attachment? – Dustin Jul 16 '12 at 19:43
-
I also have a number before 'A.' Not really sure why or what it refers to. I'm guessing it would be content that doesn't have an Artist/Band associated with it. Here is what I see... (86) | A (12) | B (19) | C (6) | D (11) | E (12) | F (2) | G (10) | H (1) | I (6) | J (28) | K (8) | L (14) | M (12) | N (8) | O (1) | P (12) | R (20) | S (22) | T (51) | V (3) | W (3) | Z (1) – Dustin Jul 16 '12 at 19:52
-
Yes, the blank entry would be nodes without an Artist/Band but, if you've checked "Require this relationship" in the field relationship, I don't think they will be included at all. – scronide Jul 16 '12 at 21:53
-
If you aren't seeing results by default, but you are when you filter, it might be that your "When the filter is /not/ in the URL" setting for the contextual filter needs to change. By default, the glossary sets a default fixed value of 'a', showing those filtered results. If you pick "Display all results" does anything appear? – scronide Jul 16 '12 at 21:59
-
Ok I have that part of it fixed. Thanks! Still wondering why I have (86) at the very beginning with no link. Looking at the source code it looks like its using a space (%20) as the first letter. I bet some of the artist/band names have a space before them.. argh. Here's the source for the empty link generated next to the (86).. – Dustin Jul 17 '12 at 13:09
-
1Yep.. a lot of the band names have a space at the beginning.. ARGH. Thanks for all your help scronide! :) – Dustin Jul 17 '12 at 13:48