Sum colum in serverSide (all records)
Sum colum in serverSide (all records)
I'm basically doing the same thing at https://datatables.net/forums/discussion/49522/sum-colum-in-serverside-all-records where @kthorngren solved it with an example that is now 404.
I'm not sure how to actually update the footer row in the drawCallback with a server side variable.
I have setup my footer with a <tfoot> code and columns like:
<th class="bg-secondary text-white" id="miles_total">TEST1</th>
In drawCallback I can see the "TEST1" as the first console and the value I want as the second:
console.log($('#miles_total div').html())
console.log(response.json.totals.miles)
I've tried various versions of this jQuery to set it with no success:
$('#miles_total div').text(response.json.totals.miles)
How can I set the tfoot value in drawCallback?
This question has an accepted answers - jump to answer
Answers
The example still works. Your browser may be changing http:// to https://. Edit the URL, in your browser, to remove the
s
from https://. For example:http://live.datatables.net/sagujiza/1/edit
.The selector
$('#miles_total div')
doesn't seem right. Try this instead without thediv
:Kevin
Thanks. I'd tried without the
div
but that hadn't worked either so I ended up getting to the example and found it worked calling it by column: