Daniel Ribeiro
Daniel Ribeiro

Reputation: 10234

Sort view by a node reference field

I need to sort my view by a specific field that is actually a node reference field.

For some reason, however, the node reference field does not appear in the sort criteria list.

Is there any reason for that? How can I solve this problem?

Upvotes: 1

Views: 1378

Answers (1)

nmc
nmc

Reputation: 8696

You can't sort by a node because Drupal wouldn't know the criteria for sorting a node to say which is first and which is second, etc.

I assume you mean that you want to sort by some field (like the title) of a node that is referenced.

To sort by a field in the referenced node, you have to the referenced node in a relationship to join the tables. Them you can simply add a sort by 'title' field but be sure to select the correct relationship under the Relationship drop down when you create the sort field.

enter image description here

Upvotes: 1

Related Questions