keystone-classic icon indicating copy to clipboard operation
keystone-classic copied to clipboard

Sort by relationship always sorts by _id of related field even though name is rendered in admin UI

Open steevsachs opened this issue 8 years ago • 3 comments

Expected behavior

When sorting by a relationship field, the sort should be alphabetical by the string that is actually rendered in the admin UI.

Actual/Current behavior

Currently the support appears to be alphabetical by the ObjectId.toString() value of the related document's _id property.

Steps to reproduce the actual/current behavior

  1. Create two Lists and include a String name property on each.
  2. Create relationship between one List and the other (many: false) and set defaultSort on the relationship owner to the property name of the relationship.
  3. Create a number of documents for the related List with various name values.
  4. Access the admin ui for that List and observe the sort.

Environment

Software Version
Keystone 4.0.0-beta.5
Node 7.6.0

steevsachs avatar May 01 '17 12:05 steevsachs

Did you ever figure this out?

layonthebeech avatar Aug 19 '19 21:08 layonthebeech

I did not.

savager avatar Aug 19 '19 21:08 savager

For anyone else stumbling here after a search: This issue seems to be so old that Keystone got rewritten in the meanwhile.

As far as I can tell, in Keystone v6, you can't sort by relations at all!

tv42 avatar Aug 25 '23 21:08 tv42