Allow Array or multi-select field type
B
Big Bam
Another year, another high-octane client passed on Strapi because of the missing multi-value field type. Watching this happen again and again since 2019. It's getting ridiculous.
Derrick Mehaffy
Big Bam: there is a community plugin for this here: https://market.strapi.io/plugins/strapi-plugin-multi-select
A.A
Derrick Mehaffy this isn't a great recommendation since the component needs to be updated all the time, like when Strapi moved to version 5. Who knows, the author could stop maintaining it tomorrow. Why not just stick with the standard functionality?
Скажи Паляниця
Still nothing?
A.A
Any progress?
S
Sileonard
Thanks for flagging this. Right now the way I'm dealing with it is a boolean switch for each option, which as you can imagine is cumbersome when you're dealing with multiple categories, each with multiple options.
Elias Leyton
This is very funny, the component exist, but just for Strapi Backedn UI?
You can found this, in /admin/settings/users/<your-user-id>
S
Ste Lendl
to implement a multi select component in a sql database this must be a many-to-many relation.
primary table
| primary_id | name | ...
The foreign table could even have a unique constraint on the id and the enum to not allow duplicate selections.
| primary_id | enum_id |
UNIQUE together (primary_id, enum_id)
adding a label with internationalization would require an additional table
| enum_id | locale | value | label |
or even one table more to deduplicate the value field.
Piers Saye
key value pairs in mysql: https://www.wix.engineering/post/scaling-to-100m-mysql-is-a-better-nosql
Shaunak Vairagare
Array of Key Value pairs on a collection is super useful and comes up often.
Say I want content managers to be able to add one or many "links" to the a collection:
Data (collection)
Links:
Key: "Download"
Value: "some url"
Key: "Metadata"
Value: "Some url"
key: "Catalog"
Value: "Url"
Both Postgres and Mongo support array type. So Array of key value pairs should be doable.
Right now it's very tacky to implement this. One could create a Links collection with "key" and "value" attribute fields. And then link it with Data, but this makes its tacky for content managers to manage a huge list of links , find them in the relationship and associate with the Data collection. Especially when most of them will have identical Keys in the Links collection.
I understand that we can provide a JSON column, but it's very tacky for non technical content managers to correctly form a JSON array for each Data item, and add the collection of links.
This Data and Links is just one example, but there are many many use cases where a free form collection of key value pairs will be required.
Am I missing something, or is there an better existing way of doing this?