Sorting by multiple columns
Setting the default sort order
You can sort by multiple fields by modifying the Secondary sort setting for a View.
- When editing a View, scroll to the bottom of the editor to find the Settings box
- Click the Filter & Sort tab
- 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)
- 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 uses the Table layout, you can sort by multiple fields.
- To enable sorting by a table column, enable the table column sorting feature.
- Click the table column header to sort by the first column
- While holding down the Shift key on your keyboard, click 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 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!