nilson.ctf
(Nilson Ctf)
February 5, 2021, 4:49pm
#1
Hello everyone!
How can I have any option from RadioButtonGroup component with enabled false programmatically?
Something like this:
When the selected is “mammal”, crocodile stay disabled.
In this case, could be an Enum class for animals options.
gorelov
(Gleb Gorelov)
February 10, 2021, 7:22am
#3
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
ckwan
(Choon Kit Wan)
August 22, 2021, 10:00am
#5
Hi Gleb,
I’ve tested above suggestion to disable the option. None of my RadioButtonGroup options disabled.
Is there anything I missed?
Regards
,CK
gorelov
(Gleb Gorelov)
August 23, 2021, 7:20am
#6
Could you please attach a demo project that reproduces the issue?
Gleb
ckwan
(Choon Kit Wan)
August 24, 2021, 4:16am
#7
Hi Gleb
Here you go. The demo project for issue reproduce.
untitled2.zip (82.3 KB)
CUBA Version: 7.2.11
Regards,
CK
gorelov
(Gleb Gorelov)
August 24, 2021, 11:12am
#8
Thank you for reporting the problem, I’ve created a GitHub issue .
1 Like