简体   繁体   中英

print datatables footer columns functioning incorrectly

I want to print a table - 5 columns - with a footer.

The footer:

<tfoot>
    <tr>
        <th colspan="4" style="text-align:right">Total:</th>
        <th></th>
    </tr>
</tfoot>

The problem is: in the print view, the footer appears with 'Total' from columns 0 to 3.

I saw this answer by the author of Datatables, Allan

https://www.datatables.net/forums/discussion/comment/88923/#Comment_88923

and it looks like there's no official solution. Maybe do some workaround.

I did some workaround, it affects slightly the appearance of the table, but prints the total in the right place.

<tfoot>
    <tr>
        <th colspan="3"></th>
        <th style="text-align:right">Total:</th>
        <th> </th>
    </tr>
</tfoot>

By changing colspan to 3, writing "Total" in the fourth column, and printing the total value in the fifth.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM