Can i add customized Dropdownlist logic?

System Information
  • Strapi Version: v3.4.1
  • Operating System: Win64x
  • Database: sqlite
  • Node Version: v14.11.0
  • NPM Version: 6.14.8
  • Yarn Version: 1.22.5

Hi there

i’m using the latest strapi release. Is it possible to customize the dropdown “load” logic (on a relation attribute/collection type) ? for example, to reduce the items with custom logic ?

2 Likes

We don’t currently have a straight forward way of applying filtering to those drop-downs yet. The feature request has come up various time (typically called a parent/child relationship, dependent relationship, or pre-filtered relationships)

1 Like

thanks for your reply.

is there a workeraround ? Is it possible to set the Dropdownlist to invisible on the Admin-UI and set the specific Attribute in the Model (Event: afterCreate) ? The needed information is available on the current Userobject.

Can you describe your use-case a bit more?

In my case a relational property should not be able to be set by the user himself, but rather
by its relation to another object (in my example the school).

I could find a solution in the meantime, as describe I have hidden the relational dropdownlist
on the UI and set the value in the beforeCreate event (based on the “created_by” value).

Do you have a better solution for this now? Also, can you please share a code snippet showing how you’ve implemented this?

@DMehaffy Do we have an approach to solve this now?

Any update on this?
any work around would be appreciated

I would love to overwrite the logic of dropdown filtering from combobox, because it always filter by “startsWith” and I don’t wan’t that. For example, I have several relationthips called “council of blablabla”, “council of blebleble” ─ but not all of them. I want to be able to search “blebleble” and get “council of blebleble”, but it only works if i write “council of blebleble”. As we add a lot of new items every day, writing “council of blebleble” is a bad idea for my users, they want to do it in the shorter way as possibile.

My idea was to write a custom logic or even disable the combobox logic, as the search is already filtering very well, but I digged into the code and I think it is not possible.

I made a gif to try to explain my usecase.
Peek 2023-09-04 17-58