diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 3 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/grid/GridStaticSectionTest.java | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 0f6912be1a..d61458297a 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -1487,8 +1487,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, rows.add(index, row); getSectionState().rows.add(index, row.getRowState()); - Indexed dataSource = grid.getContainerDataSource(); - for (Object id : dataSource.getContainerPropertyIds()) { + for (Object id : grid.columns.keySet()) { row.addCell(id); } diff --git a/server/tests/src/com/vaadin/tests/server/component/grid/GridStaticSectionTest.java b/server/tests/src/com/vaadin/tests/server/component/grid/GridStaticSectionTest.java index c0b4afbdbe..4031886e7a 100644 --- a/server/tests/src/com/vaadin/tests/server/component/grid/GridStaticSectionTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/grid/GridStaticSectionTest.java @@ -16,6 +16,8 @@ package com.vaadin.tests.server.component.grid; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.lang.reflect.Method; @@ -73,6 +75,24 @@ public class GridStaticSectionTest extends Grid { } @Test + public void testUnusedPropertyNotInCells() { + removeColumn("firstName"); + assertNull("firstName cell was not removed from existing row", + getDefaultHeaderRow().getCell("firstName")); + HeaderRow newRow = appendHeaderRow(); + assertNull("firstName cell was created when it should not.", + newRow.getCell("firstName")); + addColumn("firstName"); + assertNotNull( + "firstName cell was not created for default row when added again", + getDefaultHeaderRow().getCell("firstName")); + assertNotNull( + "firstName cell was not created for new row when added again", + newRow.getCell("firstName")); + + } + + @Test public void testJoinHeaderCells() { HeaderRow mergeRow = prependHeaderRow(); mergeRow.join("firstName", "lastName").setText("Name"); |