I'm looking for the best way to allow a user to add allergens to an article in the edit article screen. There is a list of allergens in the allergens table, and the ArticleAllergen table is a simple n:m table with the primary keys of the article and allergen. How can I add a picklist to the EditArticle which shows all allergens and allowes the user to select them (and then add these to the ArticleAllergen table)?
Many to many relationships are handled using junction table usually. For example Orders and Products tables in Northwind database are connected with many to many relationship using OrderDetails table - not sure how a component like PickList can be used in this case.
The orderdetails contains additional details, like how many pieces etc.
In this case it's just the link of which products contain which allergens. You can compare it to a list of usergroups a user is a member of; you just want to add the usergroups to the user using a simple interface
So to be sure: there is a junction table but it only has the two primary keys. Also the picklist is just an example: whatever control works easy is fine with me
I’m afraid there is no dedicated control that handles many to many relationships. Usually such UI is represented with two DataGrid components and a Form where you pick the two related keys and add a record to the junction table.
Hmm that is a shame; the PickList looks ideal.
I was hoping to use the "UserGroups" table as a source (but was missing the LoadData tag on the PickList) and bind to the User.Usergroups collection. A future addition perhaps?
We don’t have plans to add a component that handles such cases still we might receive pull request.
I've made some initial fixes / additions to make this possible, however I have no experience with opensource work. How can I create a pull request and what is needed for you to evaluate?
If your changes doesn’t brake anything and add valuable functionality we will merge it.