Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Sorting by relational field fails #521

Closed
benhaynes opened this issue Oct 25, 2018 · 1 comment
Closed

Sorting by relational field fails #521

benhaynes opened this issue Oct 25, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@benhaynes
Copy link
Member

Version Info

  • Directus version and branch (Or commit hash): 5d1e014b13c1b20502ef969b0fcb10b60566327e
  • PHP version: PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
  • MySQL version: mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper
  • Web server: (Ex. Apache, nginx or IIS?): nginx version: nginx/1.14.0 (Ubuntu)
  • OS name and version: Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-33-generic x86_64)

Expected Behavior

When adding M2M relation you should be able to sort by number of related items.

Actual Behavior

After sorting by M2M field you get an error saying that field is invalid and you no longer have access to collection's browse page because sorting is saved in directus_collection_presets.view_query.

Steps to Reproduce

  1. Add M2M relation
  2. Make field visible on browse
  3. Try to sort by that field

Schema Dump, Logs, or Screenshots

{"error":{"code":202,"message":"Invalid field "favorites""}}


Originally posted by @shota-mentesh as directus/directus#2218

@benhaynes benhaynes added enhancement New feature or request hacktoberfest labels Oct 25, 2018
@rijkvanzanten rijkvanzanten added bug Something isn't working and removed enhancement New feature or request labels Oct 26, 2018
@rijkvanzanten rijkvanzanten changed the title Sort by M2M relation count Sorting by relational field fails Oct 26, 2018
@wellingguzman
Copy link
Contributor

Sorting by one to many and many to many relational field are not allowed at the moment, the fix was to use a clear error message.

I opened a new ticket to create this feature and allow user to sort by relational fields.

Ref: #539.

samvasko pushed a commit to samvasko/api that referenced this issue Nov 25, 2019
* Hide directus_ and unmanaged collections from the menu

* Hide directus_ tables from collections overview
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants