Data Tables export not working for dynamic content

Data Tables export not working for dynamic content

sm1l3ysm1l3y Posts: 24Questions: 7Answers: 0

Ok so basically after a table has been generated/rendered through the api, I have a function that executes. The function takes fills a value in each cell of a column with the value to the cell to the left of it divided by the value of the column left to its grand total. I am not even sure I am doing the right approach for this in regards to data tables, but it works. What does not work is when I export the data table, the column is simply blank. I am assuming it is because I am not using the data tables API itself to have this column's content generated. However I am just at a loss currently on how I would achieve this since the grand total is actually generated in the footerCallback. I need the footerCallback to be completed before I can fill the values in that column of course. Any help or tips to get me on the right path would be appreciated. Also big kudos to the developers of data tables. I have been using it about a week now and it is great!

My function that executes after data tables ajax call and rendering has been completed:

$("#sct_size > tbody > tr > td:nth-child(5)").each(function () {
    var x = $("#sct_size_wrapper > div > div > div > table > tfoot > tr > td:eq(3)").html();
    x = x.replace(/\,/g, '');
    var y = $(this).prev().html();
    y = y.replace(/\,/g, '');        
    var result = parseFloat((y / x) * 100);
    result = result.toFixed(1);
    result.toString();
    $(this).html(result + "%");
})

Answers

  • sm1l3ysm1l3y Posts: 24Questions: 7Answers: 0

    I resolved this by modifying the JSON before passing it to data tables

This discussion has been closed.