2

Drupal 7 Views 3

Setting up a list of schools and their referenced courses in one table generated through views. Every school has multiple courses, therefore getting multiple rows for each school by default.

Getting:

+-------+-------+
|Schools|Courses|
|-------|-------|
|school1|courseA|
|school1|courseB|
|school1|courseC|
|school2|courseA|
|school2|courseB|
+-------v-------+

Wanting:

+-------+-----------------------+
|Schools|Courses                |
|-------|-----------------------|
|School1|courseA,courseB,courseC|
|School2|courseA,courseB        |
+-------v-----------------------+

Additional requirement: The course field is rewritten by views for it to show some additional info about a course from other fields when hovering over it.

What I already tried:

  • Views merge rows module does exactly what I need in terms of displaying results - was happy for a moment until I realized it messes up views pagination because it only changes the display of the query. Created an issue here. Edit: I wrote a patch to address this issue; ended up using this solution (see accepted answer for link).

  • Views Aggregation with concat function patch aggregates schools and correctly summarizes course names next to each school, however in each row the course names merge into a single field(?) so when hovering mouse over a course, instead of getting additional info for this course, getting it for all courses in this row. Note I am new to aggregation and probably use rewriting incorrectly in combination with it.

It's probably something one can do without any modules out of the box but it escapes me. Therefore please give any advise even if it appears obvious.

Thanks a lot!

Browse other questions tagged or ask your own question.