Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting doesn't work on a field that is relational #11743

Closed
3 tasks done
alan-cleveston opened this issue Feb 20, 2022 · 3 comments
Closed
3 tasks done

Sorting doesn't work on a field that is relational #11743

alan-cleveston opened this issue Feb 20, 2022 · 3 comments
Assignees

Comments

@alan-cleveston
Copy link

Preflight Checklist

Describe the Bug

When trying to sort a field that has a relationship, the sorting does not work, if the field is an input it works normally.

To Reproduce

To reproduce the error just use a relational field in a content and try to sort

ORDENACAO.SEM.FUNCIONAR.mp4

image

Errors Shown

No response

What version of Directus are you using?

9.5.2

What version of Node.js are you using?

16.14.0

What database are you using?

Postgres 13.4

What browser are you using?

Chrome

What operating system are you using?

Linux

How are you deploying Directus?

Docker

@licitdev
Copy link
Member

licitdev commented Feb 21, 2022

The API correctly wrongly returns the sorted values of an M2O.

Screen.Recording.2022-02-21.at.11.47.39.AM.mov

@licitdev
Copy link
Member

This issue ended up being more complex through testing as the sorting needs to be done on the rendered values. It affects displays such as related-values, translations and other custom displays for the following types: ['m2m', 'm2o', 'o2m', 'translations', 'm2a', 'file', 'files'].

@rijkvanzanten Should sorting be disabled for the above listed types?

@licitdev licitdev added the API label Feb 21, 2022
@rijkvanzanten
Copy link
Member

@licitdev There is no way to sort on a o2m, as there is no value to sort on. M2O's are currently sorted on the actual saved value, which might be different from the displayed value.

The improvement here is to implement/finish #4502, and then dynamically use that when sort is being used on a column that's relational and has a related-values display 👍🏻

I'll close this for now in favor of #4502, as it's a new feature request that already exists, rather than a bug

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants