diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2014-12-31 12:37:52 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2015-01-02 11:32:28 +0000 |
commit | 40582761f7c23b016155e173d1cb3bd73b3086fb (patch) | |
tree | 55c01f1c614fbd853c8e9fab408b95cc12a21572 | |
parent | d298d61416f719037c1c55d635d538d550994ca2 (diff) | |
download | vaadin-framework-40582761f7c23b016155e173d1cb3bd73b3086fb.tar.gz vaadin-framework-40582761f7c23b016155e173d1cb3bd73b3086fb.zip |
Fix Grid Header/Footer creating cells for unused properties (#15487)
Change-Id: I783fa6fdb44b0d5693723fc52cdb7fed3499dea1
-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"); |