how to get 2 digit after decimal in tfoot

how to get 2 digit after decimal in tfoot

NurulproNurulpro Posts: 9Questions: 4Answers: 0

how to get 2 digit after decimal in tfoot in multypale column . i am use for this footerCallback": function pageTotal = api![]

Answers

  • kthorngrenkthorngren Posts: 14,129Questions: 25Answers: 3,331
    edited October 1

    I'm not sure what the code snippet above is in relation to the footerCallback. Use the Javascript toFixed() method to format the numbers. If this doesn't help then please post a link to your page or a test case replicating the issue so we can help.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • NurulproNurulpro Posts: 9Questions: 4Answers: 0

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

    where i can use .toFixed() in this please

  • kthorngrenkthorngren Posts: 14,129Questions: 25Answers: 3,331
    edited October 1

    You use .toFixed() in Javascript. Use it in the footerCallback. Using this example change the code that is applied to the footer to use .toFixed(). For example:

                // Update footer
                $( api.column( 4 ).footer() ).html(
                    '$' + pageTotal.toFixed(2) + ' ( $' + total.toFixed(2) + ' total)'
                );
    

    Kevin

  • NurulproNurulpro Posts: 9Questions: 4Answers: 0

    thanks a lot

Sign In or Register to comment.