1

I've got some content (Employees) and I've got a View that is showing the content in a grid grouped by Department (i.e. it shows the title "Customer Support" and then a grid of Employees and then the title "Sales" and a grid of Employees, etc.)

I would like to include a paragraph of text before each section, preferably from a content node so that my users can modify the description before each section.

I've seen something online (although I'm having trouble finding it again) about being able to attach a view above another view. Is it possible to somehow display a DepartmentDescription node before each section of my grouped view?

1

You certainly can, if you use a Views relationship to load in those other Department nodes, add a field using that relationship showing the Department node body, set it to "exclude from display" (so it doesn't appear twice) and in Format: Settings set Grouping to use that specific field.

The key question then is - how does each Employee node know which is the Department node that corresponds to it? I'd suggest you use one of the node relationship/reference modules to link them together - I can vouch for relation which is good, powerful and (since a few months ago) works well with views. It isn't so easy to use and doesn't have a great interface yet, but learning to use it is time well spent, especially for the sort of site you seem to describe. If you think Relation is overkill (it is for many very simple sites), here's a guide which covers the many simpler alternatives.

With Relation, a step-by-step could be:

  1. Create the relation type (say, "is in department" source>target, "has employee" target>source, valid source: employee, valid target: department)
  2. Create a relation for each employee, linking it to its department
  3. In the view, create a node-node Relation relationship using "is in department" from the 'source' endpoint
  4. Add a content:body field, using this relationship. Set it to exclude from view
  5. In View Format: Settings, choose this body field to group the view

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.