Completed
Last Updated: 15 Dec 2020 10:14 by ADMIN
Release R1 2021
Wilberto Cordero
Created on: 04 Mar 2019 09:08
Category: Grid
Type: Bug Report
1
Status bar in Grid does not hide after Exporting a document when OnCommand client event is handled
Status bar in Grid does not hide after Exporting a document when OnCommand client event is handled
2 comments
ADMIN
Peter Milchev
Posted on: 15 Dec 2020 10:14

Hi all,

The issue is fixed and will be available as of R1 2021. 

Then, if you want to show the status bar during export and hide it using the cookies approach, you would need to improve the OnCommand handler as follows:

function OnCommand(sender, args) {
                
    if (args.get_commandName().indexOf("Export") > -1) {
        // show status panel
        var label = $get(sender._statusLabelID);
        if (label)
        {
            label.title = sender._loadingText;
            label.style["visibility"] = "visible";
        }
        pollingAPI.startPolling(function (cookieMessage) {
            //alert(cookieMessage)
            clearStatusPanel(sender)
        }, 200);
    }
}

Also, you would be able to use any loading panel instead of the status bar when exporting, e.g. RadAjaxLoadingPanel as explained here:

Regards,
Peter Milchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

ADMIN
Peter Milchev
Posted on: 04 Mar 2019 09:19
Hello Wilberto,

The following workaround based on Use cookies to help execute custom JavaScript after a file starts to download can be used: 

<telerik:RadGrid ID="RadGrid1" runat="server" OnItemCommand="RadGrid1_ItemCommand"  ShowStatusBar="true">
   ...
    <ClientSettings>
        <ClientEvents OnCommand="OnCommand" />
    </ClientSettings>
</telerik:RadGrid>

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName.Contains("Export"))
    {
        // add cookie to know the file begins downloading
        HttpCookie myCookie = new HttpCookie("file-download");
        myCookie.Value = "The file started downloading!";
        HttpContext.Current.Response.Cookies.Add(myCookie);
    }
}


<script src="polling-api.js"></script>
<script>
    function OnCommand(sender, args) {
        if (args.get_commandName().indexOf("Export") > -1) {
            pollingAPI.startPolling(function (cookieMessage) {
                //alert(cookieMessage)
                clearStatusPanel(sender)
            }, 200);
        }
    }
 
    function clearStatusPanel(grid) {
        var label = $get(grid._statusLabelID);
        if (label) {
            label.title = "";
            label.style["visibility"] = "hidden";
        }
    }
</script>

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.