We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ejGrid Export to Excel Waiting popup

Thread ID:

Created:

Updated:

Platform:

Replies:

126072 Sep 21,2016 06:04 PM UTC Mar 11,2017 06:37 AM UTC ASP.NET MVC 3
loading
Tags: Grid
Arun Gandhi
Asked On September 21, 2016 06:04 PM UTC

Hello,

I need to display waiting pop up during ejGrid Excel Export. Please let me know how this can be achieved.

Thanks

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 22, 2016 06:39 AM UTC

Hi Arun Gandhi, 

We have used form submit action for exporting Grid and so full post will occur and it reloads the page While exporting the Grid. Without making full post, we are unable to download the exported Excel file. So it is not possible to have a waiting popup for the export action of Grid when using the default “export” method of the Grid. 

But we have achieved your requirement using Ajax call and localSave option of exporting. The localSave option can be enabled using one of the overload of the export method. Please refer to the below code example. 

<div id="Grid"></div> 
 
<script type="text/javascript"> 
    $(function () { 
        var data = @Html.Raw(Json.Encode(ViewBag.data)); 
        $("#Grid").ejGrid({ 
            dataSource: data, 
               . . . . . . .  
            toolbarClick: function(args) {  
                var url = null; 
                if (args.itemName == "Excel Export") { 
                    args.cancel = true; 
                    url = "/Home/ExportToExcel"; 
                } 
                    . . .  . . 
                if (args.itemName.indexOf("Export") != -1) { 
                    $("#Grid").ejWaitingPopup("show"); 
                    var model = $.extend(true, {}, this.model); 
                    if (this.ignoreOnExport) { 
                        for (var i = 0; i < this.ignoreOnExport.length; i++) 
                            delete model[this.ignoreOnExport[i]]; 
                    } 
                    $.ajax({ 
                        type: "POST", 
                        url: url, 
                        data: { GridModel: JSON.stringify(model) },//pass the grid model 
                        dataType: "json", 
                        success: function (response) { 
                            $("#Grid").ejWaitingPopup("hide"); 
                            alert("Grid Exported"); 
                        }, 
                        error: function (Result) { 
                            $("#Grid").ejWaitingPopup("hide"); 
                            alert("Error"); 
                        } 
                    }); 
                } 
            } 
        }); 
    }); 
</script> 
 
namespace Sample.Controllers 
{ 
    public partial class HomeController : Controller 
    {  
              . . . . . 
                   . . .  . 
        public ActionResult ExportToExcel(string GridModel) 
        { 
            GridProperties gridPropert = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties),GridModel); 
            ExcelExport exp = new ExcelExport(); 
            IEnumerable data = new NorthwindDataContext().OrdersViews.ToList(); 
            exp.Export(gridPropert, (IEnumerable)data, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-lime",true,Server.MapPath("/outPut")); 
            return Json(new List<string>(), JsonRequestBehavior.AllowGet); 
        } 
             . . . . . 
    }  
} 
 
 
We have also prepared a sample that can be downloaded from the following location. 


Regards, 
Thavasianand S. 


Antonio Terron
Replied On March 9, 2017 02:19 PM UTC

Any chance to have this without the localSave option? I think it's very important to give feddback to the customer while the file is exporting

Regards


Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On March 11, 2017 06:37 AM UTC

Hi Antonio, 

We doesnot have support to achieve your requirement “display waiting popup during ejGrid Excel Export” without localSave option. Please get back to us if you need any further assistance. 

Regards, 

Farveen sulthana T 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;