Displaying a 'busy' dialog during callback

Posted by: philw on 8 September 2017, 10:23 am EST

    • Post Options:
    • Link

    Posted 8 September 2017, 10:23 am EST

    Hi,

    I was wondering if there is any way to display the Ajax style 'busy' dialog during callbacks. Some of my callbacks take a number of seconds, and it would be good to have a visual indicator to the users that something is happening, especially as the IE  'busy' indicator remains inactive during callbacks.

    I realize that I can place code in the Client events callbackStart and callBackStopped, but am not sure how to proceed from this point.

     Regards

    Phil

  • Posted 8 September 2017, 10:23 am EST

    Phil -

    See the following thread...

    http://www.clubfarpoint.com/Forums/forums/post/59037.aspx

     

    You can do a search on 'async' to see others.

  • Posted 8 September 2017, 10:23 am EST

    Wow, as simple as that. Thank you.

     My next question... How do I get to the dialog text, as I will need to localize this?

     Phil

  • Posted 8 September 2017, 10:23 am EST

    Phil -

    What dialog text are you referring to?

  • Posted 8 September 2017, 10:23 am EST

    I have set 'event.async = true' in the callBackStart event and I am now getting a very useful 'busy' dialog when the callback is in progress that says "Please Wait...". My question is, can I get to this text in order to localize it, as our web application supports multiple languages.

     Regards

    Phil

  • Posted 8 September 2017, 10:23 am EST

    That text is stored in the resx file of the spread.  I do not know of a way to get to it but I will look into it.

  • Posted 8 September 2017, 10:23 am EST

    There is not a way to get to the text that is stored in the resource file of the spread.  I will write this up as an enhancement.  For now you would have to create your own DIV to display.

  • Posted 8 September 2017, 10:23 am EST

    After some experimenting I found a way to do this...

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)



    Dim c As Control = FpSpread1.FindControl("waitMsg")

    c.Controls.RemoveAt(0)

    Dim s As String = "Calculating"

    c.Controls.Add(New LiteralControl(s))



    MyBase.Render(writer)





    End Sub

     

    This will not display the gif, however.  I am still looking into that.

  • Posted 8 September 2017, 10:23 am EST

    Here is the completed code to display a different text and the gif...

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)



    Dim c As Control = FpSpread1.FindControl("waitMsg")

    c.Controls.RemoveAt(0)

    Dim s As String = "Calculating"

    Dim imgUrl As String = Me.Page.ClientScript.GetWebResourceUrl(GetType(FarPoint.Web.Spread.FpSpread), "FarPoint.Web.Spread.img.spinner.gif")

    Dim t As String = "<img src='" + imgUrl + "'/>&nbsp;&nbsp;" + s



    c.Controls.Add(New LiteralControl(t))



    MyBase.Render(writer)





    End Sub

  • Posted 8 September 2017, 10:23 am EST

    Thanks for that Bob, I will give that a try...

    Phil

  • Posted 9 October 2017, 7:40 am EST

    Hello! I have a very similar issue and I would like to replace the “Please wait” text or remove the control altogether. I am trying to replicate the solution shown above, but it is not working as currently coded. Can anyone assist? We are using: C#, MVC3, Spread 9.4

    
    	[FarPoint.Mvc.Spread.MvcSpreadEvent("PreRender", "PlanningSht")]
            private void PlanningSht_PreRender(object sender, EventArgs e)
            {
                FpSpread spread = (FpSpread) sender;
    
                var control = spread.FindControl("waitMsg"); // THIS IS NULL 
                //control.Controls.RemoveAt(0); 
    	}
    
    
  • Posted 12 October 2017, 2:17 am EST

    Hello,

    You can handle the PreRender event for the Spread control in your controller and attach a handler for the PreRenderComplete event on the Page:

    private void FpSpread1_PreRender(object sender, EventArgs e)

    {

    FarPoint.Mvc.Spread.FpSpread fpspread1 = (FarPoint.Mvc.Spread.FpSpread)sender;

    System.Web.UI.Page page = fpspread1.Page;

    page.PreRenderComplete += new EventHandler(page_PreRenderComplete);

    }

    Handle the PreRenderComplete event for the page to add your button:

    void page_PreRenderComplete(object sender, EventArgs e)

    {

    System.Web.UI.Page page = (System.Web.UI.Page)sender;

    FarPoint.Mvc.Spread.FpSpread spread = (FarPoint.Mvc.Spread.FpSpread)page.FindControl(“FpSpread1”);

    System.Web.UI.Control c = spread.FindControl(“waitMsg”);

    Please try the code above and let me know if you face any issues.

    Thanks,

    Deepak Sharma

  • Posted 16 October 2017, 5:49 am EST

    Thanks, Deepak! That worked!

  • Posted 16 October 2017, 6:14 pm EST

    Glad to to know that!

    Regards,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels