I have been working on datatables jquery plugin and on exporting the datatable to excel, numbers in a particular column are displayed in the exponential notation. How can i convert the data to text for one column only?
I found my way around this. Here is what I did
var table = $('#example').DataTable({
dom: 'BLfrtip',
pageLength: 50,
buttons: [{
extend: 'excel',
exportOptions: {
columns: ':visible'
},
Text: 'Export To Excel',
filename: 'Transaction Report',
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
if (data.header[j] == "Column Name") {
data.body[i][j] = '\u200C' + data.body[i][j];
}
}
}
}}]});
This adds double quotes to each entry in the column