Spinner not visible

Hi team,


I have a spinner control which needs to be shown programmatically when a operation takes longer time to process. I have the below code in Razor


<div>

    <SfSpinner @bind-Visible="SpinnerVisible" Type="@SpinnerType.Bootstrap4" Size="50" Label="@SpinnerLabel" />

    @if (ProductionLogList == null)    {    }

    else

    {

        <SfGrid DataSource="@ProductionLogList" @ref="productionLogsGrid" AllowPdfExport="true" PrintMode=PrintMode.CurrentPage>

 </SfGrid>

 </div>

}


The code behind is as below.

public bool SpinnerVisible { get; set; }

 public string SpinnerLabel { get; set; }

method1()

{

 SpinnerVisible = true;

 SpinnerLabel = "Generating PDF...";

//long operation

SpinnerVisible = false;

 SpinnerLabel = "";

}

The spinner does not show up for some reason.      


Thanks

Baba        


5 Replies

BS Buvana Sathasivam Syncfusion Team February 22, 2022 04:49 PM UTC

Hi Baba, 

Greetings from Syncfusion support. 

You have dynamically changed the Visible property continuously without showing any time delay. So, the Blazor SfSpinner component is not shown. The time delay specifies how long the spinner is displayed. We suggest adding a time delay for showing the SfSpinner component using the Visible property. In the below sample, we have shown the SfSpinner component with some time delay when you click the button. Please see below the code and sample. 

<SfButton Content="Open Spinner" OnClick="method1"/> 
<div> 
 
    <SfSpinner @bind-Visible="SpinnerVisible" Type="@SpinnerType.Bootstrap4" Size="50" Label="@SpinnerLabel" /> 
 
 </div> 
 @code { 
    public bool SpinnerVisible { get; set; } 
 
    public string SpinnerLabel { get; set; } 
 
    private async Task method1() 
 
    { 
         
        SpinnerVisible = true; 
 
        SpinnerLabel = "Generating PDF..."; 
 
        //long operation 
        await Task.Delay(1000);   
        SpinnerVisible = false; 
 
 SpinnerLabel = ""; 
 
} 
 } 




Please let us know if you have any concerns. 

Regards, 
Buvana S 



PA Paolo May 6, 2022 02:05 PM UTC

Hi Baba,

following your code, as well as the documentation link, I get a compilation error:


In code section I declared the variable:

private bool VisibleProperty { get; set; } = false;

What is wrong?

I'm using v20.1.0.50 Syncfusion Blazor components.

Best regards

Paolo

 



BS Buvana Sathasivam Syncfusion Team May 9, 2022 12:27 PM UTC

Hi Paolo,


We were unable to reproduce your reported problem. Please find the below video for your reference.


Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/V_592022_163225-1654109236


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Net6Server948314230


Could you please share your full page code to reproduce your issue?


Regards,

Buvana S



PA Paolo May 9, 2022 12:46 PM UTC

Hi Buvana,

I fixed the issue. I miss @using for spinner component in _import file

Thank you

Paolo



BS Buvana Sathasivam Syncfusion Team May 11, 2022 03:48 AM UTC

Hi Paolo,


Welcome. We are glad that your reported issues are resolved. Please get back to us if you need any further assistance.


Regards,

Buvana S


Loader.
Up arrow icon