RadioButtonGroup & setItemEnabledProvider

Hi guys,
it seems that we still have some problem with the method

setItemEnabledProvider()
.

Look, for example, at the following code…
when you launch the app, the second item will appear as enabled (but it isn’t and you cannot click on it).
But after a click on the button, this time the

.getDataProvider().refreshAll()

will work and the UI correctly shows the second item as disabled.

I think It’s an old bug… any clue?

:wink:

@Theme("mytheme")
public class MyUI extends UI {
    private static final long serialVersionUID = 1L;
    private RadioButtonGroup<String> rbg = new RadioButtonGroup<>("My Disabled Group");

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();

        Button button = new Button("Click Me");
        button.addClickListener(e -> {
            rbg.getDataProvider().refreshAll();
        });

        layout.addComponents(rbg, button);

        setContent(layout);
        
        rbg.setItems("One", "Two", "Three");
        rbg.setItemEnabledProvider(item-> !"Two".equals(item));
        rbg.getDataProvider().refreshAll();
    }
    
    @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
    @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
    public static class MyUIServlet extends VaadinServlet {
        private static final long serialVersionUID = 1L;
    }
}