Based on the requirements, i have to generate 3 dataTable using a JQuery function like below and i need to implenet a button to export the result into an excel file.
I'm currently using
contentType="{!IF(isExport = true, 'application/vnd.ms-excel#UnitSummary.xls', '') and then i have <apex:commandButton style="float: right" action="{!export}" value="Export" /> export() just sets isExport to true. The problem is although it generates an excel file, the file is empty. It does not show any data. I'm assuming it's because I'm not using apex tags to generate the tables and use JQuery functions like:

function displaySummary(){

var summaryTable = '<div><big><b>Child Summary</b></big></div><br><table id="childTable" class="display" cellspacing="0">';

summaryTable += '<thead><th>Type</th><th>Sub-Type</th><th>Status</th><th>Total Units</th></thead><tbody>';
$("#childTable").DataTable({"searching": false, "lengthChange": false});

Can anyone help me to find a way to show the data on the excel file please?

I appreciate any help

| improve this question | | | | |

For anyone who is facing the same issue, I ended up using table2excel plug-in instead of using application/vnd.ms-excel and it solved my issue.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.