-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Describe the bug
When exporting a grid with joined columns the result csv output shows only the joined value.
If I define a custom header to merge the two headers, the excel export doubles the custom header.
It is not possible to define only a custom header for the csv export. So I have to decide which output is broken csv or excel.
Expected behavior
No response
Minimal reproducible example
CSV shows only joined Header
@Route("grid-exporter-test")
@PermitAll
public class GridExporterTest extends VerticalLayout {
record Person(String firstname, String lastname) {}
public GridExporterTest() {
Grid<Person> grid = new Grid<>();
var colFirstname = grid.addColumn(Person::firstname).setHeader("Firstname");
var colLastname = grid.addColumn(Person::lastname).setHeader("Lastname");
grid.setItems(new Person("Alice", "Bob"), new Person("Jane", "Doe"));
HeaderRow headerRow = grid.prependHeaderRow();
Div cellTotal = new Div("Joined cells");
cellTotal.getStyle().set("text-align", "center");
headerRow.join(colFirstname, colLastname).setComponent(cellTotal);
GridExporter gridExporter = GridExporter.createFor(grid);
gridExporter.setAutoAttachExportButtons(true);
gridExporter.setTitle("MontageFortschritt");
add(grid);
}
}
Excel doubles Custom Header
@Route("grid-exporter-test")
@PermitAll
public class GridExporterTest extends VerticalLayout
{
record Person(String firstname, String lastname) {}
public GridExporterTest()
{
Grid<Person> grid = new Grid<>();
var colFirstname = grid.addColumn(Person::firstname).setHeader("Firstname");
var colLastname = grid.addColumn(Person::lastname).setHeader("Lastname");
grid.setItems(new Person("Alice", "Bob"), new Person("Jane", "Doe"));
HeaderRow headerRow = grid.prependHeaderRow();
Div cellTotal = new Div("Joined cells");
cellTotal.getStyle().set("text-align", "center");
headerRow.join(colFirstname, colLastname).setComponent(cellTotal);
GridExporter gridExporter = GridExporter.createFor(grid);
gridExporter.setAutoAttachExportButtons(true);
gridExporter.setTitle("MontageFortschritt");
gridExporter.setCustomHeader(colFirstname, "join_firstName");
gridExporter.setCustomHeader(colLastname, "join_lastName");
add(grid);
}
Add-on Version
2.5.2
Vaadin Version
24.5.14
Additional information
No response
coderabbitai
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Inbox (needs triage)