0

Drupal 7, Views 3, etc.

I'd like to use Views' grouping feature to group results hierarchically. I added the two fields I want to group with to the grouping list. I'd like to group by year, then by term. Here's the output I get now:

  • 2011
    • Term 1
      • Result 1
      • Result 2
  • 2011
    • Term 2
      • Result 3
      • Result 4
  • 2012
    • Term 3
      • Result 5
      • Result 6
  • 2012
    • Term 4
      • Result 7
      • Result 8

... and so on.

Here's what I want to see:

  • 2011
    • Term 1
      • Result 1
      • Result 2
    • Term 2
      • Result 3
      • Result 4
  • 2012
    • Term 3
      • Result 5
      • Result 6
    • Term 4
      • Result 7
      • Result 8

I thought that by using the "Use rendered output to group rows" checkbox, it would cause Views to ignore differences in the contents of the actual date field (which is more granular than just the displayed year) and only sort by year. Am I misunderstanding this checkbox, or is there something preventing it from working properly?

  • There's an explanation with example of what the "use rendered output" checkbox means here. – EmmyS Jun 11 '12 at 17:30
  • Thanks, but that question's answer is not really clear/specific enough to help with this question. – beth Jun 11 '12 at 18:02
1

I found the answer to my question by tinkering. Like most solutions to my aggravating questions, it's stupidly simple.

I checked "remove tags from rendered output".

Upon inspection of the HTML page source, I found that the attribute content="[long, granular-to-the-millisecond datetime]" (e.g. content="2011-08-01T00:00-04:00") was plopped inside a <span> tag that was wrapped around the rendered output. So even though it looked like it was being grouped only by the 4-digit year value, it was actually being grouped by this whole, long value:

<span class ="date-display-single" content="[datetime]" datatype="xsd:dateTime" property="dc:date">[Year]</span>

Since each of these contained a totally unique datetime value, it appeared not to be grouping by year at all.

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.