1. 程式人生 > 實用技巧 >Kendo UI for jQuery資料管理使用教程:匯出故障排除

Kendo UI for jQuery資料管理使用教程:匯出故障排除

Kendo UI for jQuery R2 2020 SP1試用版下載

Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四個控制元件。Kendo UI for jQuery是建立現代Web應用程式的最完整UI庫。

匯出故障排除

本文提供將網格內容匯出到Excel時可能遇到的問題的解決方案。

引發未找到JSZip的JavaScript錯誤

如果未找到JSZip JavaScript庫,則單擊Export to Excel或呼叫saveAsExcel會引發異常。 要解決此問題,請在頁面中包含JSZip。

Excel匯出在Internet Explorer和Safari中不起作用

Internet Explorer 9和Safari不支援用於儲存檔案的選項,並且需要實現伺服器代理。 要變通解決此問題,設定proxyURL選項來指定伺服器代理URL。

<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.min.js"></script>

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
toolbar: ["excel"],
excel: {
fileName: "Kendo UI Grid Export.xlsx",
proxyURL: "/proxy"
},
dataSource: {
type: "odata",
transport: {
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Products"
},
pageSize: 7
},
sortable: true,
pageable: true,
columns: [
{ width: 300, field: "ProductName", title: "Product Name" },
{ field: "UnitsOnOrder", title: "Units On Order" },
{ field: "UnitsInStock", title: "Units In Stock" }
]
});
</script>


瞭解最新Kendo UI最新資訊,請關注Telerik中文網!