jquery datatable : Export Multiple Header

2019-05-19 08:48发布

问题:

I'm using the most recent version of DataTables 1.10.10 and Buttons 1.1.0. I'm trying to generate PDF and Excel files or Print view but I'm just getting one of the Header row,only the second one..

Here is the table:

<table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th colspan='4'>User</th>             
                <th>Start </th>
                <th>Basic</th>
             </tr>
             <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>

    </table>

I have created a js fiddle :

https://jsfiddle.net/rfb93mqs/12/

Is it possible to export report with multiple header.

回答1:

No sorry. There is no option to export multiple headers in Buttons.

(Source).

So apparently no official way ATM...

However, you could use customize in excelHtml5 options, discussed here + fiddle



回答2:

datatable not support this function.

-use custome export library or function



标签: datatables