Approved
Last Updated: 20 Mar 2019 15:37 by ADMIN
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
1 comment
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.