custom Order column when export to excel
custom Order column when export to excel
Wili
Posts: 7Questions: 1Answers: 0
Hi @colin ,I have another question ,
when i want to export the data, how to reorder the data only for excel document ?
i want the result on the excel file is ordered by column 15.
Below is my partial code:
"buttons": [{
"extend": 'excelHtml5', "text":'Export to Excel',"className": 'btn btn-secondary',
title:'',
exportOptions : {
modifier : {
// DataTables core
order : 'index', // 'current', 'applied',
//'index', 'original'
page : 'all', // 'all', 'current'
search : 'none' // 'none', 'applied', 'removed'
},
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
}
}]
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Replies
You can modify the exported display values with orthogonal data but that's not so easy with the order.
You would need to create a custom ordering plugin, force a draw with
draw()
, do the export, thenpop()
that plugin with a finaldraw()
to get the table back to how it was.Colin