How can I output initial dataset in an export csv ?

How can I output initial dataset in an export csv ?

dansumdansum Posts: 1Questions: 1Answers: 0
edited October 2017 in Buttons

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

  • allanallan Posts: 54,688Questions: 1Answers: 8,553 Site admin

    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 is display for the exported data, so you need to change that as well, like in the example).

    Allan

This discussion has been closed.