summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/ComboBox.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java
index c9622e1fd8..b9511450a5 100644
--- a/server/src/main/java/com/vaadin/ui/ComboBox.java
+++ b/server/src/main/java/com/vaadin/ui/ComboBox.java
@@ -28,17 +28,19 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
-import org.jsoup.nodes.Element;
-
-import com.vaadin.data.HasFilterableDataProvider;
-import com.vaadin.data.HasValue;
-import com.vaadin.data.ValueProvider;
import com.vaadin.data.provider.CallbackDataProvider;
+import com.vaadin.data.provider.DataChangeEvent;
import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.data.provider.DataGenerator;
import com.vaadin.data.provider.DataKeyMapper;
import com.vaadin.data.provider.DataProvider;
+import com.vaadin.data.provider.InMemoryDataProvider;
import com.vaadin.data.provider.ListDataProvider;
+import org.jsoup.nodes.Element;
+
+import com.vaadin.data.HasFilterableDataProvider;
+import com.vaadin.data.HasValue;
+import com.vaadin.data.ValueProvider;
import com.vaadin.event.FieldEvents;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
@@ -219,6 +221,11 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
getState().currentFilterText = filterText;
filterSlot.accept(filterText);
}
+
+ @Override
+ public void resetForceDataSourceUpdate() {
+ getState().forceDataSourceUpdate = false;
+ }
};
/**
@@ -962,6 +969,20 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
filterSlot = filter -> providerFilterSlot
.accept(convertOrNull.apply(filter));
+
+ // This workaround is done to fix issue #11642 for unpaged comboboxes.
+ // Data sources for on the client need to be updated after data provider
+ // refreshAll so that serverside selection works even before the dropdown
+ // is opened. Only done for in-memory data providers for performance
+ // reasons.
+ if (dataProvider instanceof InMemoryDataProvider) {
+ dataProvider.addDataProviderListener(event -> {
+ if ((!(event instanceof DataChangeEvent.DataRefreshEvent))
+ && (getPageLength() == 0)) {
+ getState().forceDataSourceUpdate = true;
+ }
+ });
+ }
}
/**