aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2016-09-26 18:45:28 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2016-09-28 00:44:10 +0300
commit96119ab0224421d69393d9d41ed02900121a683e (patch)
treeadc27cf326fdf007c24db9a742f2f41f2637fc94 /client
parent680b7009d4f453dc8eec42975192094b2e0e8e2f (diff)
downloadvaadin-framework-96119ab0224421d69393d9d41ed02900121a683e.tar.gz
vaadin-framework-96119ab0224421d69393d9d41ed02900121a683e.zip
Implement default header row in new Grid
Change-Id: Id26a98caca022ed2a4dbe0128a79721a54f5b267
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
index 0da4ec3bcc..6596137d9d 100644
--- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
@@ -219,10 +219,13 @@ public class GridConnector
layout();
}
+ /**
+ * Updates the grid header section on state change.
+ */
@OnStateChange("header")
void updateHeader() {
- final SectionState state = getState().header;
final Grid<JsonObject> grid = getWidget();
+ final SectionState state = getState().header;
while (grid.getHeaderRowCount() > 0) {
grid.removeHeaderRow(0);
@@ -230,14 +233,14 @@ public class GridConnector
for (RowState rowState : state.rows) {
HeaderRow row = grid.appendHeaderRow();
+
rowState.cells.forEach((columnId, cellState) -> {
row.getCell(getColumn(columnId)).setText(cellState.text);
});
- }
- if (grid.getHeaderRowCount() > 0) {
- // TODO Default header handling to be added in a later patch
- grid.setDefaultHeaderRow(grid.getHeaderRow(0));
+ if (rowState.defaultHeader) {
+ grid.setDefaultHeaderRow(row);
+ }
}
}