Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.flowingcode.vaadin.addons.gridhelpers;

import java.io.Serializable;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.grid.FooterRow;
import com.vaadin.flow.component.grid.FooterRow.FooterCell;
import com.vaadin.flow.component.grid.Grid;
import java.io.Serializable;
import lombok.RequiredArgsConstructor;

@SuppressWarnings("serial")
Expand All @@ -13,17 +13,22 @@ class FooterToolbarGridHelper implements Serializable {

private final GridHelper<?> helper;

private FooterCell footerCell;

public void setFooterToolbar(Component toolBar) {
Grid<?> grid = helper.getGrid();
if (grid.getFooterRows().isEmpty()) {
// create a fake footer and hide it (workaround: https://github.com/vaadin/flow-components/issues/1558#issuecomment-987783794)
// create a fake footer and hide it (workaround:
// https://github.com/vaadin/flow-components/issues/1558#issuecomment-987783794)
grid.appendFooterRow();
grid.getElement().getThemeList().add("hide-first-footer");
}
FooterRow fr = grid.appendFooterRow();
FooterCell fc = fr.join(grid.getColumns().toArray(new Grid.Column[0]));
toolBar.getElement().setAttribute("fcGh-footer",true);
fc.setComponent(toolBar);
if (footerCell == null) {
FooterRow fr = grid.appendFooterRow();
footerCell = fr.join(grid.getColumns().toArray(new Grid.Column[0]));
}
toolBar.getElement().setAttribute("fcGh-footer", true);
footerCell.setComponent(toolBar);
}

}