我在 IE9 中将 Kendo UI Grid 导出为 excel 和 pdf 时遇到问题。
Everythig 使用 Chrome 运行良好,但在 IE9 中没有任何 react 。
这是我的网格。有什么不妥或遗漏吗?
$("#gridDetalhes").kendoGrid({
dataSource: {
data: myJsonList
},
excel: {
allPages: true,
fileName: "SGD_Detalhes.xlsx"
},
toolbar: ["excel", "pdf"],
columns: [
{ field: "DataInicio", width: "135px", title: "Início", type: "date", template: '#= kendo.toString(DataInicio,"dd/MM/yyyy HH:mm:ss") #' },
{ field: "DataFim", width: "135px", title: "Fim", type: "date", template: '#= kendo.toString(DataFim,"dd/MM/yyyy HH:mm:ss") #' },
{ field: "Duracao", width: "80px", title: "Duração", type: "string" },
{ field: "Gerador", width: "40px", title: "A/M", type: "string" },
{ field: "Identificador", width: "120px", title: "Identificador", type: "string" },
]
});
最佳答案
导出功能不支持Safari、IE9及以下。
对于不受支持的浏览器,您需要提供 proxyUrl
指定服务器代理 URL。
查看 Server Proxy Implementations 的示例(适用于 ASP.NET WebForms/API/MVC、PHP、Java/Spring MVC)
例如 - ASP.NET MVC 的服务器 Controller 操作:
public class HomeController
{
[HttpPost]
public ActionResult KendoSave(string contentType, string base64, string fileName)
{
var fileContents = Convert.FromBase64String(base64);
return File(fileContents, contentType, fileName);
}
}
然后您需要提供指向此操作的 proxyUrl 参数:
excel: {
allPages: true,
fileName: "SGD_Detalhes.xlsx"
proxyURL: "/Home/KendoSave",
}
希望能帮助到你。
关于grid - Kendo UI Grid 导出到 Excel/PDF 不适用于 IE9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27784824/