Exporting Grand Total Rows

Exporting Grand Total Rows

ezos86ezos86 Posts: 22Questions: 0Answers: 0
edited January 2014 in General
For some reason, only the subtotal is being exported. Off the top of your head, can you think of how this could happen?

[code]
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
/* Calculate Total */
var ptdParkingFees_grand = 0;
var parkingFees_grand = 0;
for ( var i=0 ; i

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    TableTools export currently only outputs a single row from the footer. It would require a modification to TableTools to export more than 1 row: https://github.com/DataTables/TableTools/blob/master/media/js/TableTools.js#L1687

    Allan
  • ezos86ezos86 Posts: 22Questions: 0Answers: 0
    oh - this will take some looking into to make the change. I see aRow is an array, I imagine you could pump multiple rows into that to be exported with the footer, but I have no idea. I will need to look at everything that is going on within the TableTools.js file.

    Do you have any quick explanation, tips, advice Allan?

    It would be helpful for me when I start making changes.
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Easiest option will be to use `oSettings.nTFoot` which is the table's footer node (i.e. the `tfoot` element). Then you could use jQuery to loop over the cells and add it to the output.

    Allan
  • ezos86ezos86 Posts: 22Questions: 0Answers: 0
    And this would add it to the CSV export?
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Should do, as the CSV export gets the data to save from that function.

    Allan
  • ezos86ezos86 Posts: 22Questions: 0Answers: 0
    It's working good thanks to the edit. Thanks!
This discussion has been closed.