diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-10-13 17:40:31 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-10-14 13:45:11 +0000 |
commit | a2b1860c163a26b92b8e2ca3ae227a27b75ca55c (patch) | |
tree | f218ec383ee617eca5b7980d621fa62302769417 /client | |
parent | 0c54d540e679cce4dad71e0e8e9f3f7bc917cba3 (diff) | |
download | vaadin-framework-a2b1860c163a26b92b8e2ca3ae227a27b75ca55c.tar.gz vaadin-framework-a2b1860c163a26b92b8e2ca3ae227a27b75ca55c.zip |
Support Grid context click events in the empty areas of Grid (#19128)
Change-Id: Ia6aebc266c48fb284ebf8f7a89375390555d1bec
Diffstat (limited to 'client')
3 files changed, 15 insertions, 5 deletions
diff --git a/client/src/com/vaadin/client/connectors/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java index 0a6ba1642e..cd7007efec 100644 --- a/client/src/com/vaadin/client/connectors/GridConnector.java +++ b/client/src/com/vaadin/client/connectors/GridConnector.java @@ -1188,7 +1188,7 @@ public class GridConnector extends AbstractHasComponentsConnector implements Section section = eventCell.getSection(); String rowKey = null; - if (eventCell.isBody()) { + if (eventCell.isBody() && eventCell.getRow() != null) { rowKey = getRowKey(eventCell.getRow()); } diff --git a/client/src/com/vaadin/client/widget/grid/EventCellReference.java b/client/src/com/vaadin/client/widget/grid/EventCellReference.java index 3066e5c1db..4d37be2cc1 100644 --- a/client/src/com/vaadin/client/widget/grid/EventCellReference.java +++ b/client/src/com/vaadin/client/widget/grid/EventCellReference.java @@ -49,13 +49,19 @@ public class EventCellReference<T> extends CellReference<T> { */ public void set(Cell targetCell, Section section) { Grid<T> grid = getGrid(); - int row = targetCell.getRow(); + int columnIndexDOM = targetCell.getColumn(); - Column<?, T> column = grid.getVisibleColumns().get(columnIndexDOM); + Column<?, T> column = null; + if (columnIndexDOM >= 0 + && columnIndexDOM < grid.getVisibleColumns().size()) { + column = grid.getVisibleColumns().get(columnIndexDOM); + } + int row = targetCell.getRow(); // Row objects only make sense for body section of Grid. T rowObject; - if (section == Section.BODY) { + if (section == Section.BODY && row >= 0 + && row < grid.getDataSource().size()) { rowObject = grid.getDataSource().getRow(row); } else { rowObject = null; diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 9916d085de..90c801fc4a 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -6982,7 +6982,11 @@ public class Grid<T> extends ResizeComposite implements cell = new Cell(rowIndex, colIndex, cellElement); } else { - // Click in a place that does not have a column. + if (escalator.getElement().isOrHasChild(e)) { + eventCell.set(new Cell(-1, -1, null), Section.BODY); + // Fire native events. + super.onBrowserEvent(event); + } return; } } |