drawCallback and fnDrawCallback not working together
drawCallback and fnDrawCallback not working together
MichaelGross
Posts: 6Questions: 3Answers: 0
Hello, i have the problem that drawCallback and fnDrawCallback not working together. I need to have group Columns and sparkline chart in my Datatable. Each Section alone is working. Any can help me ?
"drawCallback": function (settings) {
var api = this.api();
var rows = api.rows({ page: 'current' }).nodes();
var last = null;
api.column(2, { page: 'current' }).data().each(function (group, i) {
if (last !== group) {
$(rows).eq(i).before(
'<tr class="alert alert-success m-b-sm"><td colspan="9" class="group">' + group + '</td></tr>'
);
last = group;
}
});
},
"fnDrawCallback": function (oSettings) {
$('.inlinesparkline:not(:has(canvas))').sparkline('html', {
type: 'bar',
barWidth: '5px',
barColor: 'green',
barSpacing: '5px',
height: '10px'
});
},
Thanks
Michael
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
In Datatables 1.10 'fnDrawCallback
and
drawCallbackare the same.
fnDrawCallback` is the old naming convention. A conversion chart from old to new naming can be found here:https://datatables.net/upgrade/1.10-convert
I would combine them into one function using
drawCallback
.Kevin