Data table data-footer-formatter value is not showing on print preview

Data table data-footer-formatter value is not showing on print preview

tanzeelanjumtanzeelanjum Posts: 5Questions: 2Answers: 0
edited January 2021 in Free community support

Hi I have a data table and I am getting a total of two columns through jquery with the help of data-footer-formatter. Now the issue is that the total value is showing normally at the footer but when I click on the print button and in print view these footer values disappear Now please tell me how I can apply CSS on this data-footer-formatter or can be appeared
The screenshot is here:
Normal highlighted value![(https://datatables.net/forums/uploads/editor/q3/7uizwql96bd7.jpg "")]

On print preview, These highlighted values disappear.![(https://datatables.net/forums/uploads/editor/if/k3sq17sy3xoy.jpg "")]

**Code for getting total is here

<th  data-field="debit" data-align="center" data-footer-formatter="totalFormatter" data-filter-control="input">
                                                <?php echo "Debit"; ?>
                                            </th>
                                            <th data-field="credit" data-align="center" data-footer-formatter="totalFormatter" data-filter-control="input">
                                                <?php echo "Credit"; ?>
                                            </th>

Script:

  function totalFormatter(data) {

        var total = 0;
        // console.log(data);
        if (data.length > 0) {

            var field = this.field;

            total = data.reduce(function(sum, row) {
                return sum + (+row[field]);
            }, 0);

            return total.toLocaleString();
        }

        return '';
    };

**

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • tanzeelanjumtanzeelanjum Posts: 5Questions: 2Answers: 0

    Kindly help I am stucked

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    Can you give me a link to a page showing that issue please? I'm a little surprised that isn't showing the footer data in the HTML output.

    Thanks,
    Allan

This discussion has been closed.