haiwan / Exporter

A Vaadin Add-on which exports data (in container) to an excel file
Other
8 stars 31 forks source link

V7 fix issue where downloading could use cache instead of refreshed data in screen #31

Closed mobileWMS closed 4 years ago

mobileWMS commented 4 years ago

If you are on a table or grid and export it to Excel, it works fine. If you then refresh the data in the grid/table, it often downloads the same exact file. Even setting the name using setDownloadFileName("newname.xls"); does not work because by that time the FileDownloader is already created and will never get refreshed until you leave the screen and come back. Since fileDownloader is private, I cannot call fileDownloader.setCacheTime(0); to get around this issue, as per https://github.com/vaadin/framework/issues/10909. I think the simplest solution would be to change this from private to protected. I am pretty sure if it was protected, I could sub-class it and just call fileDownloader.setCacheTime(0); to get around the issue. Is that possible, or am I missing something?

mobileWMS commented 4 years ago

BTW, in my forked project, ((StreamResource) fileDownloader.getFileDownloadResource()).setCacheTime(0); seems to fix it, so long as I change the file name every time I load the table ( or add to the table ).

mobileWMS commented 4 years ago

32 is the corresponding fix

mobileWMS commented 4 years ago

fix merged into 1.0.1, using #32. Closing.