Enumeration page with an add button

0
How could I do a page that shows every item an enumeration contains with a button that could add a new item for an enumeration? Thanks
asked
3 answers
2

I think an enumeration might not be what you're looking for here – an enumeration is a set of options that does not change in the runtime. If you want a variable list of options, I would recommend instead making a new entity for these values and using reference selectors wherever you want users to be able to select one of those. 

To give you an example: in one of the applications I've worked on, people need to be able to upload certain types of files. For instance, users should be able to upload an Invoice, or a Planning, or a Resume (not the real file types, just examples) and they need to be able to select these from a dropdown upon uploading a file. Now I know that new functionality might be added where users might need to upload other types of files, but I don't know which ones. For this reason, an entity called FileType was created, and admins of the application can add a new FileType object to the table. Whenever users upload a file, they can now use a reference selector to select a type of file from that table. 

answered
2

Enumerations are generally hardcoded lists in your back-end, showing them in the front-end could be possible, but your general question to add a new value is something that won’t be possible.

If you want to maintain a list of values that an user can edit, you could think about making a list entity with option entities, which has a value. This is the equivalent of an enumeration, but fully placed in the front-end for creation and usage.

So in short: Make 2 entities, one for List information and one for Option information and place a 1 to * association between them.

answered
0

It is good to know why you make a choice for enum. Recently you asked a familiar question about listing enum items automatically. Enums are statically, so if you want to add dynamically, enum is the wrong choice.

answered