[Drupal] How to display items in views using Grouping field option

| | 1 min read

This is a documentation on how the items displayed in a View can be grouped by using fields in the view. This can be performed using the 'Grouping field' option inside the Format settings of Views. Our client had a requirement where the view items displayed in the page needs to be grouped according to the filtered taxonomy term field.

Following steps are involved in the grouping process:

  • Take the edit page of the View which needs to be changed
  • Click on the settings under the 'Format' section
  • You can see a select box named 'Grouping field Nr.1 ' which lists all the fields been used in the View. Select any field from the list to set as the 'Grouping field' (In our case it was 'Taxonomy term:Name').
  • Apply the changes and save the View

Now the View items will be grouped according to the selected Grouping field and displayed in the page. I have attached a screenshot on how the View was displayed after grouping. This is a simple example of 'Group by' method in Views.