aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2019-07-24 16:49:25 +0300
committerGitHub <noreply@github.com>2019-07-24 16:49:25 +0300
commit386c5cea7659a012bdf5cc4b61c352336bff8d2f (patch)
tree09fe35bc889ecde42c886c0f3d05863da4e787da /client
parent32aa5afc0217a767e85dd579525da5a2eb1163d9 (diff)
downloadvaadin-framework-386c5cea7659a012bdf5cc4b61c352336bff8d2f.tar.gz
vaadin-framework-386c5cea7659a012bdf5cc4b61c352336bff8d2f.zip
Ensure that VComboBox.selectedOptionKey gets initial selection. (#11665)
Fixes #10741
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index 2709175c5c..b7d994745f 100644
--- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -68,6 +68,8 @@ public class ComboBoxConnector extends AbstractListingConnector
*/
private boolean forceDataSourceUpdate = false;
+ private boolean initialSelectionChangePending = true;
+
@Override
protected void init() {
super.init();
@@ -138,8 +140,13 @@ public class ComboBoxConnector extends AbstractListingConnector
"selectedItemIcon" })
private void onSelectionChange() {
if (getWidget().selectedOptionKey != getState().selectedItemKey) {
- getWidget().selectedOptionKey = null;
- getWidget().currentSuggestion = null;
+ if (initialSelectionChangePending) {
+ getWidget().selectedOptionKey = getState().selectedItemKey;
+ } else {
+ getWidget().selectedOptionKey = null;
+ getWidget().currentSuggestion = null;
+ }
+ initialSelectionChangePending = false;
}
clearNewItemHandlingIfMatch(getState().selectedItemCaption);