用于MVC导出到Excel的Kendo UI Grid没有任何作用

我正在使用Kendo网格为MVC 4.0。 我有最新的DLL 2015.1.318.440 。 我包括jszip.js 。 我复制并粘贴示例中的代码:

  .ToolBar(tools => tools.Excel()) .Excel(excel => excel.FileName("Enrollments.xlsx")) 

它什么都不做。 button改变颜色,就是这样。 我尝试时没有遇到任何错误。 它只是没有做任何事情。 我没有使用代理服务器。 我在Chrome最新版本中运行这个。

网格

 @(Html.Kendo().Grid<Trawick.Agents.Models.EnrollmentPolicy>() .Name("grid") .ToolBar(tools => tools.Excel()) .Excel(excel => excel .FileName("Enrollments.xlsx") .Filterable(true) .ProxyURL(Url.Action("Excel_Export_Save", "Enrollments")) ) .Columns(columns => { columns.Bound(p => p.enrollment_date) }) .Pageable() .Groupable() .Sortable() .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Read(read => read.Action("Enrollments_Read", "Enrollments"))) ) 

控制器

  [HttpPost] public ActionResult Excel_Export_Save(string contentType, string base64, string fileName) { var fileContents = Convert.FromBase64String(base64); return File(fileContents, contentType, fileName); } public ActionResult Enrollments_Read([DataSourceRequest]DataSourceRequest request, int? id) { string sql = "SELECT * FROM EnrollmentPolicy "; sql += SearchParams.SetSearch(this); return Json(GetEnrollments(sql).ToDataSourceResult(request)); } 

捆绑文件包括jszip

 bundles.Add(new ScriptBundle("~/js/kendo") .Include("~/Scripts/jszip.js") .Include("~/Scripts/kendo.all.min.js") .Include("~/Scripts/kendo.aspnetmvc.min.js")); 

  bundles.Add(new ScriptBundle("~/js/kendo") .Include("~/Scripts/kendo.all.min.js") .Include("~/Scripts/kendo.aspnetmvc.min.js") .Include("~/Scripts/jszip.js")); 

这是问题.jszip必须包含在kendo脚本之后(这与文档所说的相反)。

我的问题是关于卷 – 较less的logging工作,大批量不。 我目前的解决方法是设置AllPages(false),然后它只会导出一个过滤列表。 见http://www.telerik.com/forums/excel-export-not-working-with-more-than-a-thousand-records

根据文件,你需要这样做,我认为。

调节器

 [HttpPost] public ActionResult Excel_Export_Save(string contentType, string base64, string fileName) { var fileContents = Convert.FromBase64String(base64); return File(fileContents, contentType, fileName); } 

CSHTML

  .Excel(excel => excel .FileName("Enrollments.xlsx") .Filterable(true) //omit this if you don't need filtering in excel .ProxyURL(Url.Action("Excel_Export_Save", "Grid")) // for browsers not supporting saving file from JS ) 

请参阅这里的演示代码和文档,通过这个链接

我刚刚有同样的问题 – 导出button无所事事。 我正在运行2014年第三季度的剑道。

升级到最新的DLL并更新到最新的JavaScript库和样式为我解决了这个问题。