Sorting by multiple columns

Note: Added in GravityView 2.3.

Setting the default sort order

You can sort by multiple fields by going to the View Configuration's "Filter & Sort" tab, then selecting a field in the "Sort by secondary field" setting dropdown list.

  1. When editing a View, scroll to bottom of the editor to find the View Configuration box
  2. Click the Filter & Sort tab
  3. Set the primary sort field, if desired (by default, it will sort by the ID of an entry, which is based on the order it was created)
  4. Set the secondary sort field by selecting a field in the "Sort by secondary field" setting dropdown list

Note: If you are sorting by random, the secondary sort option will be hidden.


On the front end of the site

If your View is using the Table layout, you can sort by multiple fields.

  1. To enable sorting by a table column, enable the table column sorting feature.
  2. Click the table column header to sort by the first column
  3. While holding down the Shift key on your keyboard, clicking the second column you want entries to be sorted by.

Examples of multi-sorting

This table is sorted by year, with no secondary sort.

First Last Year of Birth
Tommy Lee Jones 1946
Jada Pinkett Smith 1971
Frances Tiafoe 1998
Jaden Smith 1998
Amandla Stenberg 1998
Maya Hawke 1998
You Young 2004

Shift-clicking on the Last header column adds a secondary sort so that the table is first sorted by year, and then sorted by the last name.

Note how the last names are now in alphabetical order:

First Last Year of Birth
Tommy Lee Jones 1946
Jada Pinkett Smith 1971
Maya Hawke 1998
Jaden Smith 1998
Amandla Stenberg 1998
Frances Tiafoe 1998
You Young 2004

If you need to sort your View by two fields, multi-sort is the way to go!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.