How to Sort Drupal Views Alphabetically

drupal sort views alphabetically

Alphabetical sorting is one of the most common ways people want to sort content in Views.

You may want to sort many types of content from A to Z, from staff members to business listings.

Here’s how to add alphabetical sorting to your Drupal views.

Option #1. Create a new view

  • Go to Structure > Views > Add new view.
  • Enter any views settings you want, except for “sorted by”. You should choose “Title” for this setting.
  • Click “Continue and Edit”.
media_1417526439934.png
  • Scroll down to your preview at the bottom of the view. You’ll see that your view is sorted alphabetically, but from Z to A.
media_1417526486798.png

Now we’ll fix the Z to A sorting.

  • Look under “Sort Criteria” and click on “Content: Title (desc).
media_1417526510533.png
  • Change “Sort descending” to “Sort ascending”:
media_1417526527101.png
  • Check the Preview and you’ll see that your view is now sorted alphabetically:
media_1417526578717.png

Option #2: Changing an existing view

If you want to add alphabetically sorting to an existing view, the process is very similar:

  • Click “Add” next to “Sort Criteria”.
media_1417526791376.png
  • Search for “Content: Title” or another field that you want use for alphabetical sorting.
media_1417526826052.png
  • Choose “Sort ascending” to sort your view from A to Z.
media_1417526853388.png

Instructor

  • Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Blog Rating
Subscribe
Notify of
11 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Anthony Pero

Any idea how to “page” alphabetically?

steve

Hi Anthony
Could you explain that question a bit more?

Anthony Pero

Views Paging. Sometimes I’d like the pager to page alphabetically, so the pager is A – B – C – D – E, etc, instead of 10 nodes on a page and 1 – 2 – 3 – 4 – 5, etc… This would be especially useful in a list of proper names, such as employees, schools, Sports Teams…

steve

Got it, thanks. Have you see the default “Glossary” view? That seems to do exactly what you describe.

Anthony Pero

I’ll check it out, thanks. Is that a pager setting, or a default view that needs to be enabled? Or something else?

steve

Yes, a default view to enable.

harfoyun

Thank you!

Артем Ильин

Any idea how to make search index(apache solr) view sortable by date field? There isn’t any default date sort criteria to use. So I must create one, but I can’t figure out how to make it work.

You could add a date field to the content type and then pull that into the view. Or use the date created date.

Артем Ильин

No. Unfortunately, It won’t help.

But I found the solution. To make search view sortable by date you have to add date field to search index.

Tammy P

The title sorting works great. However, we have a view that lists libraries and members (title was used for their names). The libraries are in order by when they were added to the site. This means any new member library we have ends up at the bottom of the list. Do you know of a way to get two different items in a view to sorted alphabetically?

11
0
Would love your thoughts, please comment.x
()
x