Datatables Export - use custom data when export
Datatables Export - use custom data when export
Hello,
I would like to use csvHTML5 : https://datatables.net/reference/button/csvHtml5
I would like to do something a little different that normal case.
In my Datatables using server-side processing , I use aoColonns (to display soms of the json data I received).
But I want this : when I click the button export , I would like to export another data (that I have display).
The only way to do it as I saw : invisible colonns and then use the exportOptions paramater to select the colomns I would like to export.
But I don't want to do it ,isn't possible to use another way ?
This question has an accepted answers - jump to answer
Answers
.
Sorry can't answer
Please try to be serious one day
outrageous sentence
There are two different options:
Regards,
Allan
Thanks for your help.
In examples here on datatables.net , I saw only examples with colomns who exists both in the ajax reponse and the Datatables.
But I would like to iterate on the data json I received on another colomns (who I didn't use on the DataTables)
For example , If I have these colomns on my JSON reponse :
ID,First_Name,AColomnNotInDataTables
and I display
ID,First_Name
How could I do when I click on export to get AColomnNotInDataTables in the result ?
Currently the export will export columns only. You can use the methods I suggested above to modify the data in those columns, but if you need an entirely extra column, you would need to add that column to your table (make it hidden with
columns.visible
).Allan
Thanks , I hope one day it may be work with ajax source.