Display count of calculated row in pdfexport
Display count of calculated row in pdfexport
I have a json sourced table with ticket quantity and price columns, and a subtotal column which multiplies the 2 values together
The column is generated like so...
{ data: null,
render: function ( data, type, row ) {
subtotal = Math.round( row.tblorderdetails.DetailPrice * row.tblorderdetails.DetailQuantity );
return subtotal;
}
}
And I have a footerCallback to display the sum on the table footer
How can I output the sum of this calculated column to a pdf export, as it doesn;t export the footer?
I can output the quantity ok
var tcount = dt.column( 3 ).data().reduce( function (a, b) {return parseInt(a) + parseInt(b); } );
return tcount+' tickets';
but as the data in the column is null, i get NAn output if I try and do the same with the calculated column
This question has an accepted answers - jump to answer
Answers
but
You need to use
cells().render()
to get the rendered data (rather thancolumn().data()
to get data which doesn't exist). If you do a search forcells().render()
you'll find a few other threads on this topic if you would like more details.Allan
Thanks Allan
Needed a few attempts to get the syntax, but looks like i got there...