modify cell values via drawCallback?
modify cell values via drawCallback?

I have successfully done some data calculations via the drawCallback function in the API per the suggestion of another user here. However I cannot seem to figure out how to modify the cells I need with the new data. Here is my function which works and logs the calculations to the console...
"drawCallback": function (settings) {
var api = this.api();
var myData = api.rows({ page: 'current' }).data();
var z = $("#sct_size_wrapper > div > div > div > table > " +
"tfoot > tr > td:eq(3)").html();
z = z.split(',').join('');
for (var i = 0; i < myData.length; i++) {
var y = myData[i][3];
var result = parseFloat((y / z) * 100);
result = result.toFixed(2);
console.log(result);
myData[i][4] = result;
}
}
Any help or tips would be appreciated!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Maybe you need to add
api.rows({ page: 'current' }).invalidate();
between lines 13 and 14. This should cause the table to refresh.Kevin
Is it the footer that you want to insert the data into? Or a cell in the
tbody
?Allan
cell in tbody
@kthorngren, thank you so much! Your suggestion worked perfectly...you have saved me a LOT of time and trouble!