Adding vaadin component on fieldGroup

Hi,

How can I easily add a vaadin component to a fieldGoup, example with a custom=true and generator= ?

Hi,
for this purpose, you can create a box component and add it to the FieldGroup as a field. After that, you can add any Vaadin component to the box. See the example below:

@Override
    public void init(Map<String, Object> params) {
        fieldGroup.createField("score");
        Component box = componentsFactory.createComponent(VBoxLayout.class);
        fieldGroup.getFieldNN("score").setComponent(box);
        Layout layout = (Layout) WebComponentsHelper.unwrap(box);
        layout.addComponent(stepper);
        stepper.setSizeFull();
        stepper.addValueChangeListener(event ->
                customerDs.getItem().setValue("score", event.getProperty().getValue())
        );
    }
1 Like