RadioButtonGroup component with any option disabled

Hello everyone!

How can I have any option from RadioButtonGroup component with enabled false programmatically?
Something like this:
image
When the selected is “mammal”, crocodile stay disabled.
In this case, could be an Enum class for animals options.

Hi,

There is no public API in CUBA component, but you can unwrap the Vaadin component and use its API, e.g.:

@Inject
private RadioButtonGroup<CustomerGrade> radioButtonGroup;

@Subscribe
public void onInit(InitEvent event) {
    CubaRadioButtonGroup<CustomerGrade> rbg = this.radioButtonGroup.unwrap(CubaRadioButtonGroup.class);
    rbg.setItemEnabledProvider(grade -> {
        // do checks
    });
}

Regards,
Gleb

Hi Gleb,

I’ve tested above suggestion to disable the option. None of my RadioButtonGroup options disabled.

Is there anything I missed?
Regards
,CK

Could you please attach a demo project that reproduces the issue?

Gleb

Hi Gleb

Here you go. The demo project for issue reproduce.

untitled2.zip (82.3 KB)

CUBA Version: 7.2.11

Regards,
CK

Thank you for reporting the problem, I’ve created a GitHub issue.

1 Like