summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridClientSelectionTest.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java16
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");
}