1

I have a view of content type "event". One of the fields is a category of the event which is a taxonomy list and i have a field for the date and time the event takes place.

Now i have set up the view showing the events in a time period i can set through an exposed filter, grouping the events by their date-field (nr.1) and as a second group field by the category (nr.2).

I am sorting this view with the event-field (ascending) as the first sort criteria and Taxonomy term: Weight as the second sort criteria.

It works as designed, but every event that shares the same time on a given date creates an own group row:

Like this:

  • Category-Name
    • 4/12/2013
      • Event1 12.00h
      • Event2 12.00h
    • 4/12/2013
      • Event3 13.00h
    • 4/12/2013
      • Event5 14.00h
      • Event6 14.00h

What i want to achieve is this:

  • Category-Name
    • 4/12/2013
      • Event1 12.00h
      • Event2 12.00h
      • Event3 13.00h
      • Event5 14.00h
      • Event6 14.00h

Question: is it possible to have a formatter that has stripped out the time, so i can group by date only?

Of course i tried a custom display formats for the date beforehand, but this doesn't affect the grouping.

EDIT: the hint about the RDF module helped partly with this issue. I could remove the extra markup in the date field. Nevertheless the sorting of the date field still takes the time of the event into account. There's another sorting i didn't mentioned in the first place, cause I didn't expect it to be relevant.

The location of an events is referenced as entity and also added to a row of an event and sortet by title (asc). Now the date-field is superceding the title of the location, because the event-time is still taken into account.

I had started another question on this other issue, but actually think it belongs here. I still need to strip out the time somehow...

2
+100

Views uses the rendered value for the field, including the field wrappers to do grouping. In your case, views is treating each date field differently.

There are 3 ways this can be fixed. One of the following methods should do it.

  1. Remove the tags from the rendered output.

    screenshot

  2. Using a custom template and a preprocess function, you can strip all markup and print the output only.

    1. views-view-fields.tpl.php
    2. template_preprocess_views_view_field
  3. Turn off the RDF module. Views will take care of the grouping itself. The RDF module adds extra metadata to your markup, which makes views separate the grouping as shown in your example above instead of grouping the similar dates together.

  • What does the RDF module have to do with this? Also, your answer does not tell the person asking the question how to fix their problem. – rooby Apr 21 '13 at 2:02
  • I don't know the reasons, but it really removes the extra markup thats confusing the view. – Volker Apr 21 '13 at 13:08
  • I updated my question, though i consider the original question answered, if my edit is beyond the acceptable. – Volker Apr 21 '13 at 13:26
  • Coincidentally, someone in my office ran into this problem today. Just doing #1 of your 3 ways fixed the problem. – rooby Apr 24 '13 at 5:23
0

Under the format settings you can set a field to group the rendering on.

This screencast Learn Views with NodeOne, part 16: Grouping fields shows how to group fields, which is hopefully helpful.

The grouping doesn't care at all for the formatter, which I think is correct behavious, so going down that route won't be helpful.

There are also related complex options called aggregation, check out Learn Views pt 28: The aggregation setting.

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.