Refresh/reload fields values after dropdown selection

I use a WebPickerField for a reference and some additional fields which show details from the selected entity.
The detail fields get the data from the same datasource (e.g. property = client.name).

It works fine when selecting a reference from the browser table (dots button) but the detail fields do not update when selecting the reference using the dropdown (dropdown button).

grafik

The only way I found was to manually set each field value on datasource property change event.
Something like this:
((TextField)clientFG.getComponent(“clientname”)).setValue(getItem().getClient().getName());

But i hope there is a better way.
Thanks!

One way would be to create a new view for the entity from the dropdown with the fields you need.
And set that as the view for the dropdown datasource (or container if your using CUBA7+)

1 Like

Another way is to reload the selected entity with the required view in the LookupPickerFiled’s ValueChange event and set it to a separate datasource which the details FieldGroup is linked to.