Loading state on export

Hi,

is it possible to show some kind of loading state on using the export functions (ExcelExport, CsvExport) on the DataGrid?

Because on big datasets it took a lot of time and the user get no feedback and think the export doesn't work!


Best regards

Sven


3 Replies

MS Monisha Saravanan Syncfusion Team January 18, 2022 01:28 PM UTC

Hi Sven, 

Yes, it is possible. We suggest you to invoke ShowSpinnerAsync and HideSpinnerAsync methods of the Grid. So that spinner will be shown during exporting. Kindly refer the below code snippet and sample for your reference 

 
<SfGrid @ref="Grid" DataSource="@Orders" Height="700" AllowPdfExport="true" AllowExcelExport="true" Toolbar="@(new List<string>() { "ExcelExport","CsvExport","PdfExport" })"> 
    <GridEvents ExportComplete="ExportCompleteHandler" OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents> 
    ... 
</SfGrid> 
 
@code{ 
 
    public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args) 
    { 
        if (args.Item.Text == "Excel Export") 
        { 
            await Grid.ShowSpinnerAsync(); 
            await this.Grid.ExcelExport(); 
             
        } 
         
    } 
 
    public async void ExportCompleteHandler(object args) 
    { 
        await Grid.HideSpinnerAsync(); 
    } 
} 


Refer the below API documentation for your reference 


Kindly revert us if you have further queries. 

Regards, 
Monisha S 



SB Sven Boris Bornemann January 24, 2022 08:38 AM UTC

Hi,


it worked.


Thank you and best regards

Sven



VN Vignesh Natarajan Syncfusion Team January 25, 2022 03:50 AM UTC

Hi Sven,  

Thanks for the update.  

We are glad to hear that you have resolved your query using our solution.  

Please get back to us if you have further queries. 

Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon