drawcallback inside column data
drawcallback inside column data
drawCallback: function (hola) {
hola= $('#average').DataTable().column(0).data().sum() /$('#average').DataTable().rows().count();
$('#totaal').html(hola);
},
columns: [
{
title:
"Tiempo promedio",
data: "",
render: function (data, type, row) {
return (
data
);
},
},
],
>
Hello, I want to put the result that the drawcallback gives me (it is a number) inside the column "Tiempo promedio" and show it to me in the table. It can?
This discussion has been closed.
Replies
The
drawCallback
option runs aftercolumns.render
. Alsocolumns.render
doesn't always run when the table is drawn. It only runs if its needed like for table data changes.Are you saying that you want one column to display the total
hola
in each row of the table?You can use
cells().every()
indrawCallback
to iterate a column to update the data in that column. Something like this:Where
cell(null, 1)
means all rows and column 1.Kevin