From f12a23c9c6bb176dd0550f07d6ddeb1e91c84bfc Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 2 Aug 2017 09:12:21 +0300 Subject: Fix RadioButtonGroup selection updates to client (#9749) This patch provides a simple fix for the majority of issues. There are still issues that should be fixes by refactoring parts of the logic in AbstractSingleSelect. This patch does not unify the handling of empty values in the TestBench elements of various AbstractSingleSelects. Fixes #9494 --- .../src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/src') diff --git a/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java b/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java index 7cfaf7572e..1386005351 100644 --- a/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java +++ b/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java @@ -227,9 +227,13 @@ public class VRadioButtonGroup extends FocusableFlowPanelComposite } public void selectItemKey(String selectedItemKey) { - RadioButton radioButton = keyToOptions.get(selectedItemKey); - if (radioButton != null) {// Items might not be loaded yet - radioButton.setValue(true); + if (selectedItemKey != null) { + RadioButton radioButton = keyToOptions.get(selectedItemKey); + if (radioButton != null) { // Items might not be loaded yet + radioButton.setValue(true); + } + } else { + keyToOptions.values().forEach(button -> button.setValue(false)); } } } -- cgit v1.2.3