IE11 export to excel not working with JSON data export
IE11 export to excel not working with JSON data export
Hi,
We are using ajax call to get the data from DB in JSON format and then converting into datatables. Export to excel functionality was working fine with tabletools.js. We are trying to upgrade to button, however export with csv seems to working but NOT "excel".
I get the same error on the example with ajax data as I get with my code
"Excel found unreadable content in DataTables example - Format output data - export options.xlsx. Do you want to recover the contents of this workbook? If you bust the source of this workbook, click
Yes."
$('#aiSearchResults').DataTable( {
data: dataSet,
deferRender: true,
columns: [
{
title: "Action Item ID",
"data" : "actionItemID",
"render" : function (data, type, row, meta)
{
// alert("testing ["+data+"]");
// returns hyperlink on the first ID column to load the details page
return anchorTagStart + data + colName + anchorStartTagEnd + data + anchorTagClose;
}
},
{ title: "Contract Number", "data" : "contractNumber" },
{ title: "Contractor Name", "data" : "companyName" },
{ title: "Type", "data" : "actionItemType" },
{ title: "Current Owner", "data" : "actionItemOwnerName" },
{ title: "Current Status", "data" : "actionItemStatus" },
{ title: "Date Created", "data" : "creationDate" },
{ title: "Date Resolved", "data" : "resolutionDate" }
],
scrollY: 200,
scrollX: true,
"order": [[0,"desc"]],
"dom": 'Bfrtip',
"buttons" :[{
extend: 'excelHtml5',
title: 'Action Item Html5',
messageTop: 'List Action Items',
messageBottom: 'The information in this table is copyright to OCMS.',
orientation: 'landscape',
exportOptions: {
trim: false,
stripHtml: false,
format: {
body: function ( data, row, column, node ) {
console.log("[" + data + "]")
console.log("[" + $(node).text() + "]")
return $(node).text();
}
}
}
},
{
extend: 'csv',
text: 'Export to CSV'
}
]
} );
Answers
Lots of threads on this issue, checkout this one:
https://datatables.net/forums/discussion/comment/133425#Comment_133425
Kevin