mardi 8 septembre 2020

How to implement a list feature that limits options based on other selected options?

This is a general design question to a problem I am facing.

I am implementing a UI list of items where the user can select multiple items at once. Some of the options, however, are grouped in a sense that only one of those items may be selected at once due to business logic. E.g. If list contains items, A, B, C there needs to be a way to specify the logic where either A, B or C can be selected at once.

I have considered implementing within the class design a variable which contains list of the other items which are grouped and so cannot be selected if any in that list are already selected. However, this seems like a difficult thing to maintain because if there are 3 items in a group, all 3 must be updated if an additional item is added to that group.

What would be a better design solution to this problem?

Aucun commentaire:

Enregistrer un commentaire