Support sorting by a specific field in relationship fields (e.g. useAsTitle or designated field) #12451
jessrynkar
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Overview:
Currently, when sorting by a relationship field in the collection list view, Payload applies the sort using the related document's ID.
This can be confusing when it doesn't align with the
useAsTitle
value and is restrictive as it doesn't allow users to sort by their desired field.Expected Behavior:
When sorting by a relationship field in the collection list view, Payload should:
useAsTitle
that has been defined in the related collectionAND/OR
Why This Matters:
useAsTitle
is already used to display the relationship value—sorting by it would align display>behavior and prevent confusionProposed Solution:
sortByField
or similar optionuseAsTitle
ifsortByField
is not definedCurrent workaround
Since this new virtual field feature was introduced, you can utilize virtual fields easily to create a sortable entity for a relationship field. For a full example, see my response here.
Related Threads:
#3978 – Original discussion
Beta Was this translation helpful? Give feedback.
All reactions