angular - Angular 6 kendo-excelexport 组件找不到数据时如何显示无数据导出警报

标签 angular angular6 kendo-grid export-to-excel

下面是代码:我使用了 angular 6 kendo-excelexport ^4.5.0 版本组件。

<kendo-excelexport [data]="excelDataToExport" [collapsible]="true" fileName="Sample.xlsx" #excelexport>
                <kendo-excelexport-column field="taxMonth" title="Month" [width]="200">
                </kendo-excelexport-column>
                <kendo-excelexport-column field="clientName" title="Client Name" [width]="200">
                </kendo-excelexport-column>
                <kendo-excelexport-column field="alertType" title="Alert Type" [width]="200">

                <kendo-excelexport-column field="Description" title="Description" [width]="200">
                </kendo-excelexport-column>

</kendo-excelexport>

最佳答案

查看excelDataToExport的长度如果是数组。如果长度大于 0,请下载 Excel 表格,否则会显示警报。

为此,请在 click 上使用条件表达式。导出按钮的事件。

请找到工作示例:Demo

在示例中注释/取消注释 product.ts 文件中的数据以分别查看无数据警报/下载 excel。

关于angular - Angular 6 kendo-excelexport 组件找不到数据时如何显示无数据导出警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59842467/

相关文章:

javascript - Angular 4 和 Node.js

Angular6如何测试一系列http请求

javascript - Angular 6,滚动到顶部

javascript - 在 Kendo Grid 客户端模板中使用开关

kendo-ui - 编辑或创建 Kendo Grid 条目时检测服务器端错误

javascript - Angular 2 RadioButton 选中

angular - 如何避免 Angular ngClass 中的重复?

javascript - 类型错误 : map is not a function

Angular6 -> 构建错误

jquery - 保持 Kendo 网格中所选选项卡之间的滚动位置