我遇到类似的问题,为什么我的excel
导出按钮不起作用?
怎么了感谢您的帮助。
$("#grid").kendoGrid({
toolbar: ["create", "excel", "pdf"],
excel: {
fileName: "Test.xlsx",
allPages: true
},
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: {
data: [
{ id: 1, name: "Jane Doe", age: 30 },
{ id: 2, name: "John Doe", age: 33},
],
schema: {
model: { id: "id" }
}
},
editable: true
});
.k-grid-toolbar {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.k-grid-toolbar .k-grid-excel {
margin-left: auto;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.common.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.mobile.all.min.css"/>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.1.220/js/kendo.all.min.js"></script>
</head>
<body>
<div id="grid"></div>
</body>
</html>
答案 0 :(得分:2)
如果您已经检查了浏览器的控制台,您会发现Kendo会丢失某些库。 “要充分利用Excel导出功能,请下载JSZip库,并在Kendo UI JavaScript文件之前包含该文件,如图所示”:https://docs.telerik.com/kendo-ui/framework/excel/introduction#requirements
答案 1 :(得分:0)
试试这个:
toolbar: ["excel"],
excel: {
fileName: "Excel File Name.xlsx",
filterable: true,
allPages: true
},