Parent & child relationship/field
Yannis Kadiri
The easiest example to explain is laid out like this, we have the following models:
- Make
- Model
- Sales
In this context we are talking about cars, so the make would contain a list of car manufacturers (Subaru, Toyota, Ford, Chevy, ect). Thus the model would contain some options like WRX, GT86, Mustang, Corvette.
The way we would setup the sales model would be a oneWay relation to each make/model, and in the context of this request when we create a new "sale" we would select the make (say subaru) now when I go to select the model I should only be able to see/select the "WRX" model since it's made by Subaru.
I should not be able to select "Toyota" "Mustang" as that car doesn't exist.
See for more information: https://github.com/strapi/strapi/issues/8708
Dimitrii Tkach
I wrote a plugin that introduces the custom field that does this
https://github.com/dimatkach11/strapi_plugins
In the first gif you can see normal behavior
In the second gif you can see the behavior with the custom field
raku
Dimitrii Tkach
good!!!!!!
Dimitrii Tkach
I just wrapped up the documentation for the plugin, strapi-plugin-parent-child-relationships, and it’s officially live on npm! You can check it out here:
- https://www.npmjs.com/package/strapi-plugin-parent-child-relationships
For those currently using the old version, I’ve included instructions on how to transition to the new plugin:
- https://github.com/dimatkach11/strapi_plugins
N
Nguyen Nam
We need this, please do it in Srapi V5
A
Alexandre Phiev
Still very interested in that key CMS feature.
E
Ellis Madagan
100% something we'd use.
Michael
We need RBAC to filter the relation dropdown ASAP!!
currently our solution would be intercepting the controller['relations'] through register function. But that is not clean. Please put this in your priority roadmap.
This kind of functionality is very important for big corporations type use.
thanks for the great product!
Patrik Albertsson
We really need this in our upcoming project. Is there any updates on this feature? Or some workaround?
Derrick Mehaffy
Merged in a post:
Allow constraints/filters in relationships
Javier Diaz Chamorro
Currently, we can define the relation model but we cannot define constraints or filters in this relation.
Use Case
You define a new blog block called
Popular Posts
, and to improve the editor's experience and prevent errors from occurring it should show only those posts that match to some category.Otherwise, there should be the possibility to show other fields in the selection dropdown in the relationship, for example,
Title - Category
, in order to make a more accurate search.Szymon Jankowski
I'm quite suprised this feature is not prioritized. Could we at least have any information if it's considered worth developing and planned for any future?
Aaron Ho
Definitely needed, it's currently impossible to build a taxonomy-based/hierarchy-based content-type without being able to filter/select a parent relation.
We are also exploring the option to build our own plugin but it would be good to know if this is being prioritized any time soon?
Ankit Gujaria
Aaron Ho Is it possible with custom plugin ?
Chonk
The lack of real ontology like this feature is why I didn't go with Strapi
F
Fabien
Chonk: I feel the same way. I am really missing a category tree. It would be great if we could use it to build a page tree with a nested data structure.
Load More
→