Unplanned
Last Updated: 03 May 2024 06:41 by ADMIN
Deasun
Created on: 28 Apr 2023 13:38
Category: Grid
Type: Bug Report
6
The value of the FileName parameter is not updated properly in the OnBeforeExport event handler

The value of the FileName parameter is not updated properly in the OnBeforeExport event handler.

 

4 comments
ADMIN
Stamo Gochev
Posted on: 03 May 2024 06:41

Hi all,

Changing the name of the file with the following code:

<GridExcelExport FileName="@FileName" OnBeforeExport="@(()=> { FileName="test"; } )"/>

is not something that was intended to work (thus it worked by chance). The reason for this is that in order for the modified variable to be applied, a render cycle in the Blazor framework should happen while the "OnBeforeExport" event is happening, which is something that is not recommended.

Instead of making a "fix" for the workaround, we will probably consider exposing a "FileName" argument in the "OnBeforeExport" event, so that it can be overridden just like you can change the data or the columns.

Regards,
Stamo Gochev
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Dan
Posted on: 26 Apr 2024 18:13
This workaround no longer works. The filename remains the same as it was before the OnBeforeExport event is triggered. Just the same as changing the data and the columns seems pretty simple to expose the Filename attribute to allow the user to change the name. In my usecase, I have part of the name that needs to come back from the database as it calls the request to get that data (not same format as grid data). So I would need to call to get data in OnBeforeExport to get the part of the filename I need. Then move into setting the filename before the file is finally built.  OnAfterExport allows you to change and manipulate the file as well but does not allow you to update the filename either.
ADMIN
Yanislav
Posted on: 05 Jul 2023 11:33

Hello Ted,

Indeed, the link was broken. Thank you for bringing this to our attention!

I have edited the Bug report description, and now the link should work correctly.

Regards,
Yanislav
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Ted
Posted on: 28 Jun 2023 19:08
The REPL snippet is not a link above.