FieldGroup not gets notified from datasource entity changes

Hi, I need to assign a price property for an entity that is being edited, taking the product selection on an editing screen; then when the product/article changes (from a lookup combo) I take its price and assign it to the price of the current entity (as you see in the image with the name “Importe”). The problem is how i can refresh the FieldGroup with the new price value?. if i refresh the datasource as you see in the attached code, the “fieldgroup” not gets notified.

image

    @Override
    protected void postInit() {
        super.postInit();

        getItem().addPropertyChangeListener((e) -> {
            if (e.getProperty() == "articulo") {
                Articulo articulo = (Articulo) e.getValue();

                if (articulo != null) {
                    this.getItem().setImporte(
                            articulo.getPVenta());
                    fieldGroup.getDatasource().refresh();  // --> this not reload changes
                }
            }
        });

    }

HI
try this way
if("articulo".equals(e.getProperty())) { if(e.getItem().getArticulo() !=null){ getItem.setImporte(getItem().getArticulo().getPVenta()) } }
Also make sure you use appropriate view to catch the PVenta value

Hi, @marc.delphi!

You don’t need to refresh the datasource after a property change. Remove the following line:

fieldGroup.getDatasource().refresh();

Regards,
Gleb