Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CSV、PDF、Excel文件作为blob在数据表的导出扩展中下载_Javascript_Excel_Csv_Datatables - Fatal编程技术网

Javascript CSV、PDF、Excel文件作为blob在数据表的导出扩展中下载

Javascript CSV、PDF、Excel文件作为blob在数据表的导出扩展中下载,javascript,excel,csv,datatables,Javascript,Excel,Csv,Datatables,我编写了一个以各种格式导出数据的演示: HTML代码: <div class="container" style="position: relative;top:60px;"> <div class="row"> <table id="empTable" class="display table-bordered" width="100%" cellspacing="0"> <the

我编写了一个以各种格式导出数据的演示:
HTML代码:

<div class="container" style="position: relative;top:60px;">
        <div class="row">
            <table id="empTable" class="display table-bordered" width="100%" cellspacing="0">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Designation</th>
                        <th>Office</th>
                        <th>Extension</th>
                        <th>Joining Date</th>
                        <th>Salary</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th>Name</th>
                        <th>Designation</th>
                        <th>Office</th>
                        <th>Extension</th>
                        <th>Joining Date</th>
                        <th>Salary</th>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>  
var editor;
    $('#empTable').dataTable({
        dom: 'Bfrtip',
        "ajax": "empdata.json",
        "columns": [{
            "data": "name"
        }, {
            "data": "designation"
        }, {
            "data": "office"
        }, {
            "data": "extension"
        }, {
            "data": "joining_date"
        }, {
            "data": "salary"
        }],
        select: true,
        buttons: [
            {
            extend: 'collection',
            text: 'Export',
            buttons: [
                'copy',
                'excel',
                'csv',
                'pdf',
                'print'
            ],  
        }]
        /*buttons: [{
            extend: 'create',
            editor: 'myEditor',
            formButtons: [{
                label: 'cancel',
                fn: function() {
                    this.close();
                }
            }]
        }]*/
    });  
这里是jsfiddle链接:

当我以各种格式下载表格数据时,它会以
blob
的形式下载,但不会以
csv
pdf
excel
的形式下载。。。原因是什么

不确定“它以blob形式下载,但不是csv、pdf、excel形式下载”是什么意思。它只是缺少示例中的文件名

如和中所述

默认情况下,由。。。按钮类型将自动取自文档的title元素

因此,您可以在
title
元素中设置文件名:


示例:

谢谢,伙计。。。修好了