summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-09-14 11:33:57 +0300
committerVaadin Code Review <review@vaadin.com>2016-09-14 11:44:01 +0000
commita7f874e9422fe8bc7dad15dadf74a32aa4c75c8d (patch)
tree0f2e04b5bcffa1c8828a1f65c87b8577da7437b4 /client
parent62d712fb4514b2ed118539f43967c9b24d906518 (diff)
downloadvaadin-framework-a7f874e9422fe8bc7dad15dadf74a32aa4c75c8d.tar.gz
vaadin-framework-a7f874e9422fe8bc7dad15dadf74a32aa4c75c8d.zip
Selection should be updated each time when new data is set (#244).
There is no order in two actions: set data source and selection. So selection should always be saved to update the index once data is set. Change-Id: I074d99adb1f11bf29ebaef50979d4cacda5cd1e4
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java
index c61b7efc3c..ffda0166e3 100644
--- a/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java
@@ -41,8 +41,8 @@ import elemental.json.JsonObject;
* @since 8.0
*/
@Connect(com.vaadin.ui.NativeSelect.class)
-public class NativeSelectConnector extends
- AbstractListingConnector<SelectionModel.Single<?>> {
+public class NativeSelectConnector
+ extends AbstractListingConnector<SelectionModel.Single<?>> {
private HandlerRegistration selectionChangeRegistration;
private Registration dataChangeRegistration;
@@ -75,8 +75,8 @@ public class NativeSelectConnector extends
if (dataChangeRegistration != null) {
dataChangeRegistration.remove();
}
- dataChangeRegistration = dataSource.addDataChangeHandler(
- this::onDataChange);
+ dataChangeRegistration = dataSource
+ .addDataChangeHandler(this::onDataChange);
super.setDataSource(dataSource);
}
@@ -130,5 +130,6 @@ public class NativeSelectConnector extends
// Remove extra items if the new dataset is smaller than the old
select.removeItem(i);
}
+ updateSelectedItem();
}
}