Dynamic Attributes : Bug in rendering lookup field when attribute is entity type and is collection

Hi guys !

Thank you for you great framework !

By doing some tests on dynamic attributes I encountered a bug in this specific configuration:

  • Creating a dynamic attribute of type ‘Entity’
  • Selecting ‘Lookup field’ = true
  • Selecting ‘IsCollection’ = true

Creation itself is ok but when trying to create or edit an entity on the UI I got this error message:
IllegalStateException: Unable to find action with id values_select

After a small debug exercice I think I found the source of the bug:

In the class io.jmix.dynattrui.impl.factory.DynAttrComponentGenerationStrategy it looks like there is a small problem in the method
createCollectionField

The select action is added to the values picker at line 187:
valuesPicker.addAction(selectAction);
while line 184 is already trying to use this action:
setValuesPickerOptionsLoader(valuesPicker, attribute, valueSource);

I have done a small test pushing the addAction call before line 184 and it seems to work well for me.

I don’t know enough the framework to be sure that it is the right way to correct this bug but I hope this can help.

Best regards,

Cedric

Hi Cedric,

Thank you for the report and thorough investigation!
Looks like you have enough information to create an issue. PRs are also welcome :slight_smile:

Regards,
Konstantin