summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-10-18 17:31:37 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2016-10-19 11:32:25 +0000
commit5bc6d1802e2da2c600fb8559474e86ec1b3b4bf7 (patch)
treea94fe6dfff1074069633f34ad8788f28a9730016 /client/src
parent5fc90cda4c27402414fd31c1b87194968321a2fa (diff)
downloadvaadin-framework-5bc6d1802e2da2c600fb8559474e86ec1b3b4bf7.tar.gz
vaadin-framework-5bc6d1802e2da2c600fb8559474e86ec1b3b4bf7.zip
Implement basic footer support for Grid
Change-Id: I3db51521320767a28bc3acd9586b1453764a15bc
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java22
1 files changed, 22 insertions, 0 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 4686b3bd21..a19c955fc4 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
@@ -53,6 +53,7 @@ import com.vaadin.client.widget.grid.sort.SortEvent;
import com.vaadin.client.widget.grid.sort.SortOrder;
import com.vaadin.client.widgets.Grid;
import com.vaadin.client.widgets.Grid.Column;
+import com.vaadin.client.widgets.Grid.FooterRow;
import com.vaadin.client.widgets.Grid.HeaderRow;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.data.DataCommunicatorConstants;
@@ -264,6 +265,27 @@ public class GridConnector
}
}
+ /**
+ * Updates the grid footer section on state change.
+ */
+ @OnStateChange("footer")
+ void updateFooter() {
+ final Grid<JsonObject> grid = getWidget();
+ final SectionState state = getState().footer;
+
+ while (grid.getFooterRowCount() > 0) {
+ grid.removeFooterRow(0);
+ }
+
+ for (RowState rowState : state.rows) {
+ FooterRow row = grid.appendFooterRow();
+
+ rowState.cells.forEach((columnId, cellState) -> {
+ row.getCell(getColumn(columnId)).setText(cellState.text);
+ });
+ }
+ }
+
@Override
public void setDataSource(DataSource<JsonObject> dataSource) {
super.setDataSource(dataSource);