diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-03-20 14:06:06 +0200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-03-20 14:06:06 +0200 |
commit | 9cf87e1423b1c4e0358112615433bbbf2bc47da3 (patch) | |
tree | 391aaed0ea64ba5b8cd26ea61dbe48cfac04c374 /client | |
parent | 2036525461599c5ae74173eaf86e032dc89e7bf3 (diff) | |
download | vaadin-framework-9cf87e1423b1c4e0358112615433bbbf2bc47da3.tar.gz vaadin-framework-9cf87e1423b1c4e0358112615433bbbf2bc47da3.zip |
Fix selecting rows from header and footer (#10720)
Diffstat (limited to 'client')
-rwxr-xr-x | client/src/main/java/com/vaadin/client/widgets/Grid.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 8a6d7abfdd..1d24086b3b 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -26,13 +26,14 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.atomic.AtomicInteger; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.TreeMap; +import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Stream; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -2403,8 +2404,15 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, EventTarget target = getNativeEvent().getEventTarget(); Grid<?> grid = getGrid(); if (Element.is(target) && grid != null) { + final RowContainer container = Stream + .of(grid.escalator.getHeader(), + grid.escalator.getBody(), + grid.escalator.getFooter()) + .filter(c -> c.getCell(target.cast()) != null) + .findFirst() + .orElse(grid.cellFocusHandler.containerWithFocus); + Section section = Section.FOOTER; - final RowContainer container = grid.cellFocusHandler.containerWithFocus; if (container == grid.escalator.getHeader()) { section = Section.HEADER; } else if (container == getGrid().escalator.getBody()) { @@ -8640,7 +8648,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * Adds a spacer visibility changed handler to the underlying escalator. * * @param handler - * the handler to be called when a spacer's visibility changes + * the handler to be called when a spacer's visibility changes * @return the registration object with which the handler can be removed * @since 8.3.2 */ |