Show loading panel when saving Spreadsheet

2 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1696 posts
    Member since:
    Oct 2004

    Posted 13 Jun Link to this post

    Requirements

    Telerik Product and Version

    UI for ASP.NET AJAX 2017 R2

    Supported Browsers and Platforms

    all browsers supported by Telerik UI for ASP.NET AJAX suite

    Components/Widgets used (JS frameworks, etc.)

    RadSpreadsheet, .NET 4.0/4.5 C#/VB

    PROJECT DESCRIPTION 
    This example demonstrates how to show a LoadingPanel when saving the Spreadsheet. 

    The Save method of the Spreadsheet fires a callback to the server, which is not caught by the PageRequestManager and RadAjaxManager. That is why, even though the Spreadsheet is AJAX-enabled, no loading panel is displayed when saving. 

    One workaround for this issue is overriding the save and _onCallbackResponse methods of the RadSpreadsheet and show/hide a Loading panel manually as described in the Show and Hide AjaxLoadingPanel explicitly article.

    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <script>
            var currentLoadingPanel = null;
            var currentUpdatedControl = null;
            var originalFunction = Telerik.Web.UI.RadSpreadsheet.prototype.save;
     
            Telerik.Web.UI.RadSpreadsheet.prototype.save = function () {
                // show the loading panel
                currentUpdatedControl = "<%= RadSpreadsheet1.ClientID %>";
                currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID %>");
                currentLoadingPanel.show(currentUpdatedControl);
     
                // callback start
                originalFunction.call(this);
            }
     
            Telerik.Web.UI.RadSpreadsheet.prototype._onCallbackResponse = function () {
                // callback ended
                //hide the loading panel
                if (currentLoadingPanel != null) {
                    currentLoadingPanel.hide(currentUpdatedControl);
                }
     
                // clean up the global variables
                currentUpdatedControl = null;
                currentLoadingPanel = null;
            }
        </script>
    </telerik:RadCodeBlock>

     
  2. Daniel
    Daniel avatar
    3 posts
    Member since:
    Jun 2017

    Posted 07 Nov in reply to Telerik Admin Link to this post

    Is there a way for this script to catch a exception from the CustomSpreadsheetProvider save method? Are there documentation for the other methods of Telerik.Web.UI.RadSpreadsheet.prototype? Perhaps Telerik.Web.UI.RadSpreadsheet.prototype.onErrorResponse?

    Thank you

Back to Top