jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
692 stars 124 forks source link

Data Binding on HTML Elements Fails for Nested Entity Property Paths #3677

Closed mariodavid closed 4 weeks ago

mariodavid commented 2 months ago

Environment

Jmix version: 2.4.0-SNAPSHOT

Bug Description

When trying to bind an HTML element to an entity property path, a java.lang.IllegalArgumentException is thrown. The issue seems to be related to the recent implementation that enables data binding on HTML components, but does not currently support property paths.

Steps To Reproduce

  1. Create a project using Jmix version 2.4.0-SNAPSHOT.
  2. Attempt to bind an HTML element to a nested property path, e.g.:

    <span id="manufacturer" dataContainer="inspectionDc" property="turbine.manufacturer" />
  3. Run the application

Current Behavior

The application throws the following exception:

java.lang.IllegalArgumentException: Can't find getter for property 'turbine.manufacturer' at class io.jmix.windturbines.entity.inspection.Inspection
    at io.jmix.core.metamodel.model.utils.MethodsCache.getGetter(MethodsCache.java:203) ~[jmix-core-2.4.999-SNAPSHOT.jar:na]
    at io.jmix.core.entity.BaseEntityEntry.getAttributeValue(BaseEntityEntry.java:85) ~[jmix-core-2.4.999-SNAPSHOT.jar:na]
    at io.jmix.flowui.data.binding.impl.HtmlContainerReadonlyDataBindingImpl.lambda$bind$2(HtmlContainerReadonlyDataBindingImpl.java:101) ~[jmix-flowui-2.4.999-SNAPSHOT.jar:na]

Expected Behavior

The data binding should support entity property paths similarly to how it’s handled in other components, like the DataGrid. The expected behavior is that the property path turbine.manufacturer should be correctly resolved and bound without throwing an exception.

konyashkina commented 4 weeks ago

Tested on Jmix version: 2.4.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6896-242 IntelliJ version: IntelliJ IDEA 2024.2.3