diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2019-11-04 13:26:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-04 13:26:32 +0200 |
commit | 0b627f975ddae79d4d9d1cf4b12e6c31eb31eb7a (patch) | |
tree | 32abf08c369e475e50b6a19322036bce2a435835 /server | |
parent | f5984b1cb69e32ea138c72dc2f2b47809cda74f8 (diff) | |
download | vaadin-framework-0b627f975ddae79d4d9d1cf4b12e6c31eb31eb7a.tar.gz vaadin-framework-0b627f975ddae79d4d9d1cf4b12e6c31eb31eb7a.zip |
Check actual Grid selection instead of relying on allSelected flag. (#11787)
The checkbox for selecting all rows only selects all the rows that have
not been filtered out. Changing the filtering does not change the
selection or the checkbox state so assuming that all rows are selected
simply because the checkbox has been checked cannot work.
Fixes #11479
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java index f51744c96e..0ef1d1a5f7 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java @@ -15,7 +15,24 @@ */ package com.vaadin.ui.components.grid; -import com.vaadin.data.provider.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.vaadin.data.provider.DataCommunicator; +import com.vaadin.data.provider.DataProvider; +import com.vaadin.data.provider.HierarchicalDataProvider; +import com.vaadin.data.provider.HierarchicalQuery; +import com.vaadin.data.provider.Query; import com.vaadin.event.selection.MultiSelectionEvent; import com.vaadin.event.selection.MultiSelectionListener; import com.vaadin.shared.Registration; @@ -23,11 +40,6 @@ import com.vaadin.shared.data.selection.GridMultiSelectServerRpc; import com.vaadin.shared.ui.grid.MultiSelectionModelState; import com.vaadin.ui.MultiSelect; -import java.util.*; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; - /** * Multiselection model for grid. * <p> @@ -134,8 +146,7 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T> @Override public boolean isSelected(T item) { - return isAllSelected() - || selectionContainsId(getGrid().getDataProvider().getId(item)); + return selectionContainsId(getGrid().getDataProvider().getId(item)); } /** |