How can I output initial dataset in an export csv ?
How can I output initial dataset in an export csv ?
Hi there,
I have a dataset which content some boolean value that visually I render with an Icon via this function :
var table = $('#table').DataTable({
"ajax": "xxxx",
"columns": [
{"data": "subscribed", "render": function(data, type, row) {return data ? '<i class="state-true fa fa-check"></i>' : '<i class="state-false fa fa-close"></i>'},
The problem is when I export to CSV => it export the rendered row.
I would like to keep the default boolean value in the CSV (so initial data without rendered data) but also keep the behavior of the export (when you filter and search etc).
How can achieve that ?
Thx !
Answers
Use the orthogonal data options. Basically you want to have your rendering function return the binary value when the
export
data type is used (note that the default isdisplay
for the exported data, so you need to change that as well, like in the example).Allan