aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorOlli Tietäväinen <ollit@vaadin.com>2019-07-12 10:44:55 +0300
committerZhe Sun <31067185+ZheSun88@users.noreply.github.com>2019-07-12 10:44:55 +0300
commit901705e1c8ef4253cccef07999f79ffdc5e2bcd4 (patch)
treeb740ee5ee919d69196dd5e6f0cef9fd3f467fe6b /client
parent41de4e402e4b718804c71e9629c2030ff17df3e4 (diff)
downloadvaadin-framework-901705e1c8ef4253cccef07999f79ffdc5e2bcd4.tar.gz
vaadin-framework-901705e1c8ef4253cccef07999f79ffdc5e2bcd4.zip
11642 refresh pagelength 0 combobox items after dataprovider update (#11653)
* Fixes #11642. ComboBox with pageLength 0 should be updated if DataProvider changes * added comments, fixed imports
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java17
1 files changed, 16 insertions, 1 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 2ef091569d..2709175c5c 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
@@ -62,6 +62,12 @@ public class ComboBoxConnector extends AbstractListingConnector
*/
private String pendingNewItemValue = null;
+ /**
+ * If this flag is toggled, even unpaged data sources should be updated on
+ * reset.
+ */
+ private boolean forceDataSourceUpdate = false;
+
@Override
protected void init() {
super.init();
@@ -123,6 +129,11 @@ public class ComboBoxConnector extends AbstractListingConnector
getWidget().setEmptySelectionCaption(getState().emptySelectionCaption);
}
+ @OnStateChange("forceDataSourceUpdate")
+ private void onForceDataSourceUpdate() {
+ forceDataSourceUpdate = getState().forceDataSourceUpdate;
+ }
+
@OnStateChange({ "selectedItemKey", "selectedItemCaption",
"selectedItemIcon" })
private void onSelectionChange() {
@@ -503,9 +514,13 @@ public class ComboBoxConnector extends AbstractListingConnector
@Override
public void resetDataAndSize(int estimatedNewDataSize) {
if (getState().pageLength == 0) {
- if (getWidget().suggestionPopup.isShowing()) {
+ if (getWidget().suggestionPopup.isShowing()
+ || forceDataSourceUpdate) {
dataSource.ensureAvailability(0, estimatedNewDataSize);
}
+ if (forceDataSourceUpdate) {
+ rpc.resetForceDataSourceUpdate();
+ }
// else lets just wait till the popup is opened before
// everything is fetched to it. this could be optimized later on
// to fetch everything if in-memory data is used.