diff options
author | Artur Signell <artur@vaadin.com> | 2015-07-05 21:17:25 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-07-07 17:09:11 +0000 |
commit | d2c3e30f20e7566c34f0ee775d68b809583328b4 (patch) | |
tree | b08eb3df9cb38e0972fe818ce2c3f562921fcabf | |
parent | 61fe18d7771b378bc5c5211276489127c35c96ee (diff) | |
download | vaadin-framework-d2c3e30f20e7566c34f0ee775d68b809583328b4.tar.gz vaadin-framework-d2c3e30f20e7566c34f0ee775d68b809583328b4.zip |
Ensure correct render of selection when changing selection model (#17087)
Change-Id: I79547b32a7b7bec0ea2b327ceb0b69c756e2e812
3 files changed, 32 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index e47418a740..28527d7a86 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -6809,6 +6809,9 @@ public class Grid<T> extends ResizeComposite implements selectionModel.setGrid(this); setSelectColumnRenderer(this.selectionModel .getSelectionColumnRenderer()); + + // Refresh rendered rows to update selection, if it has changed + refreshBody(); } /** diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientSelectionTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientSelectionTest.java index a341e39b74..d1d7b21e11 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientSelectionTest.java @@ -195,4 +195,17 @@ public class GridClientSelectionTest extends GridBasicClientFeaturesTest { isRowSelected(1)); } + @Test + public void testChangeSelectionModelUpdatesUI() { + openTestURL(); + + setSelectionModelSingle(true); + getGridElement().getCell(5, 1).click(); + assertTrue("Row 5 should be selected after clicking", isRowSelected(5)); + setSelectionModelNone(); + assertFalse( + "Row 5 should not be selected after changing selection model", + isRowSelected(5)); + + } } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java index 74972fe4d2..9953bbcae0 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java @@ -319,6 +319,22 @@ public class GridSelectionTest extends GridBasicFeaturesTest { .isSelected()); } + @Test + public void testChangeSelectionModelUpdatesUI() { + openTestURL(); + + setSelectionModelSingle(); + + getGridElement().getCell(5, 1).click(); + assertTrue("Row should be selected after clicking", getRow(5) + .isSelected()); + + setSelectionModelNone(); + assertFalse( + "Row should not be selected after changing selection model", + getRow(5).isSelected()); + } + private void setSelectionModelMulti() { selectMenuPath("Component", "State", "Selection mode", "multi"); } |