Hi Haijian, Great addon and really happy to use it. Yet, I'm not a fan tha

Hi Haijian,

Great addon and really happy to use it.
Yet, I’m not a fan that I have to set a key for each column every time.
Maybe you have an example how to make it easer for the user? I mean, leave as much as possible room for mistakes when typing field name for the key.

Also, is there is a way to set Column label for exported file?

Thank you!

Hi Karolis,

Thanks for the feedback, and really glad to hear that this simple addon is helpful. Which version of this exporter are you using?
For Vaadin 8 version, i.e. 2.0.2 onward, you can set up a custom column header as below

ExporterOption exporterOption = new ExporterOption();
exporterOption.getColumnOption("name").columnName("My Name").toUpperCase();
exporterOption.getColumnOption("email").columnName("My Email");
exporterOption.getColumnOption("age").toUpperCase();

StreamResource csvStreamResourceWithCustomHeader = new StreamResource((StreamResource.StreamSource) () -> Exporter.exportAsCSV(grid, exporterOption), "my-csv-with-custom-header.csv");
FileDownloader csvFileDownloaderWithCustomHeader = new FileDownloader(csvStreamResourceWithCustomHeader);
csvFileDownloaderWithCustomHeader.extend(downloadAsCSVWithCustomHeader);

It’s not available in the Experter 3.x.x yet, I will make it available there soon

Hey again,

I’m using 3.0.1 with Vaadin 14.
Is upcoming changes will be similar to what you demonstrated above? We will have to use additional configuration object?
Isn’t there a way just take current header of the table? Just curious.

Hi Karolis

yes, it will be same as in the version for Vaadin 8.

I also tried to get the header directly. But currently there is lacking of such APIs, such as https://github.com/vaadin/vaadin-grid-flow/issues/567. Once those APIs are there, then the API could be simplified.