Save relation items order (Issue #2166)

Here’s a workaround that works for us:

  • If you haven’t already, create your ‘parent’ entity type that will refer to the relations
  • Add a Component Collection field to the content type, name it the plural of the other content type
  • Choose to create a new Component for this Component Collection
  • Add a single field to the Component, which is a 1:1 relationship to another Content Type, i.e. the one you want to assign ordered relations of
  • Save the new content type (Strapi restarts)
  • Create a new item of the new type
  • Fill the component collection with components, each with a the foreign content type’s item of your choosing, assigned as the only relation
  • Change the order in the component collection as you wish
  • Save
  • Use REST or the GraphQL playground to retrieve the data, and notice the order is respected
4 Likes