OptionsGroup set preselected items


I have 2 entities: Employeer(name,positions) and Position(title).
I have one-to-many relationship between them, the employeer can have many positions.
I added an optionsgroup component with the positions in the employeer editor page.
How can I prefill the selected items from this group when editing an employeer?
I thought something like

Employeer x = employeerDs.getItem();

But I get null pointer for the employeer datasource…

Solved it, within the postInit method, the datasource is initialized after the init method.

1 Like