summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorMatti Tahvonen <matti@vaadin.com>2015-05-29 16:22:26 +0300
committerVaadin Code Review <review@vaadin.com>2015-06-08 07:19:26 +0000
commit5ae33b641eea02b647825b27c311d4116f3be838 (patch)
treecc731c84e62a14b7a3a621841cb7590ee3081f04 /server
parentb0d5315e8ba95d099f93dc2d16339033a6525b59 (diff)
downloadvaadin-framework-5ae33b641eea02b647825b27c311d4116f3be838.tar.gz
vaadin-framework-5ae33b641eea02b647825b27c311d4116f3be838.zip
Selection is now shown although scrollToSelectedItem is false (#16673)
If scrollToSelectedItem is set to false (which is needed to work properly with large datasets) the selected item caption is sent to client with a special attribute to avoid the field looking like unselected. Change-Id: Ib80355c3b52faaaeaa9ab7195644701cc3bf0d15
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/ComboBox.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java
index 4af93113f9..033ec3cd14 100644
--- a/server/src/com/vaadin/ui/ComboBox.java
+++ b/server/src/com/vaadin/ui/ComboBox.java
@@ -288,6 +288,13 @@ public class ComboBox extends AbstractSelect implements
// Paint variables
target.addVariable(this, "selected", selectedKeys);
+ if (getValue() != null && selectedKeys[0] == null) {
+ // not always available, e.g. scrollToSelectedIndex=false
+ // Give the caption for selected item still, not to make it look
+ // like there is no selection at all
+ target.addAttribute("selectedCaption",
+ getItemCaption(getValue()));
+ }
if (isNewItemsAllowed()) {
target.addVariable(this, "newitem", "");
}