Many-to-many relationship editor (with TwinColumn)


I have a project where “Supplier” is in many-to-many relationship with “Product”.

What is the best way to create an editor for a many-to-many relationship?

The automatic UI screen creation inserts just a Products list, but what I’m really looking for is a browser where I can add-remove-edit single instances.

I’ve tried with TwinColumn and an “Add” button, but I didn’t manage to write the invoke method… when I try to access the value of the injected TwinColumn I get a null…



The simplest way to create UI for entities with Many-to-Many relation is to create views (in CUBA Studio) for each entity and include entity from another side of relation into this view.
Then right-click to this views and choose “Create Generic UI screen”. Studio will generate default browser screen and edit screen with the FieldGroup component for entity’s fields and the Table component for related entities.
To display related entities in browser screen you should add a column to the table that should have an id of a property that represents a relation.

Ask questions, if you have some.