Datatable tabletool pdf Export最后显示一些额外的行

时间:2015-07-01 04:57:19

标签: html datatable datatables

当我使用datatable tabletool pdf export时,最后有一个额外的列,内容为两行。 Html部分:

<table class="example tab" id="trip_tabless">
    <tfoot class="tabl tab-abs">
    <tr>
    <th style="display:none"></th>
    <th style="display:none"></th>
    <th style="display:none"></th>
    <th style="display:none"></th>
    <th style="display:none"></th>
    <th style="width:300px" id='plateno'></th>
    <th style="display:none"></th>
    <th style="width:300px" id='cancelled'></th>
    <th style="display:none"></th>
    <th style="display:none"> </th>
    </tr>
    </tfoot>
    <thead>
    <tr>
    <th style="display:none">Booking #</th>
    <th style="width:300px">Booking Date</th>
    <th style="display:none">Customer Details</th>
    <th style="display:none">Booking Type</th>
    <th style="display:none">Driver Id</th>
    <th style="display:none">Auto Plate #</th>
    <th style="display:none">Driver Response</th>
    <th style="display:none">Cancelled</th>
    <th style="display:none">Total Fare</th>
    <th style="display:none">Action</th>
    </tr>
    <tr>
    <th>Booking #</th>
    <th>Booking Date</th>
    <th>Customer Details</th>
    <th>Booking Type</th>
    <th>Driver Id</th>
    <th>Auto Plate #</th>
    <th>Driver Response</th>
    <th>Cancelled</th>
    <th>Total Fare</th>
    <th>Action</th>
    </tr>
    </thead>        
    <tbody>
        <tr><td>5</td><td>Jun 10,2015</td> <td><span class="drive-name">Karthik</span><span class="drive-phone">11111111111</span></td><td>Fast Booking</td><td>auto plateno</td> <td>test test</td><td>Accepted</td><td>No</td> <td>25.12833404541</td>  <td> <a href="#"><button class="view-btn btn-sm"><span class="icon"></span></button></a></td></tr>
            <tr><td>4</td><td>Jun 10,2015</td> <td><span class="drive-name">Karthik</span><span class="drive-phone">11111111111</span></td><td>Fast Booking</td><td>auto plateno</td> <td>test test</td> <td>Accepted</td> <td>No</td> <td>27</td><td> <a href="#"><button class="view-btn btn-sm"><span class="icon"></span></button></a></td></tr>
            <tr><td>3</td><td>Jun 10,2015</td> <td><span class="drive-name">Karthik</span><span class="drive-phone">11111111111</span></td><td>Fast Booking</td><td>auto plateno</td> td>test test</td> <td>Accepted</td><td>No</td> <td>27</td> <td> <a href="#"><button class="view-btn btn-sm"><span class="icon"></span></button></a></td></tr>
            <tr><td>2</td><td>Jun 10,2015</td> <td><span class="drive-name">Karthik</span><span class="drive-phone">11111111111</span></td><td>Fast Booking</td><td>auto plateno</td> <td>test test</td><td>Accepted</td> <td>No</td> <td>27</td> <td> <a href="#"><button class="view-btn btn-sm"><span class="icon"></span></button></a></td></tr>
            <tr><td>1</td><td>Jun 12,2015</td> <td><span class="drive-name">Karthik</span><span class="drive-phone">11111111111</span></td><td>Manual Booking</td><td>auto plateno</td> <td>test test</td><td>Accepted</td> <td>No</td> <td>27</td><td> <a href="#"><button class="view-btn btn-sm"><span class="icon"></span></button></a></td></tr></tbody></table>

请帮助我如何在导出的pdf文件中单独获取正确的行

1 个答案:

答案 0 :(得分:0)

这非常简单。

您需要使用mColumns,它定义将在PDF中使用的导出中包含哪些列。

http://datatables.net/extensions/tabletools/button_options#mColumns