FlowingCode / GridExporterAddon

Apache License 2.0
10 stars 9 forks source link

Component column headers are not exported #33

Closed javier-godoy closed 1 year ago

javier-godoy commented 1 year ago

As explained in https://stackoverflow.com/a/74380144/1297272, component headers are exported as empty strings (because GridHelpers only retrieves string headers)

Grid<String> grid = new Grid<>();
Column<String> col1 = grid.addColumn(x -> x).setHeader("Has text header");
Column<String> col2 = grid.addColumn(x -> x).setHeader(new Span("Text header"));
System.out.println(GridHelper.getHeader(grid, col1));
System.out.println(GridHelper.getHeader(grid, col2)); //prints an empty string

Implement a feature that allows setting custom headers/footers for GridExport.

Also, consider defaulting component headers to column.getHeaderComponent().getElement().getTextRecursively() if Vaadin version is 23.2+ (for now, use reflection since 23.1 has to be supported)