Datatables Export - use custom data when export

Datatables Export - use custom data when export

jy95jy95 Posts: 5Questions: 1Answers: 0

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

  • romainLeThugromainLeThug Posts: 2Questions: 0Answers: 0
    edited April 2016

    .

  • romainLeThugromainLeThug Posts: 2Questions: 0Answers: 0
    edited April 2016

    Sorry can't answer

  • jy95jy95 Posts: 5Questions: 1Answers: 0

    Please try to be serious one day

  • jy95jy95 Posts: 5Questions: 1Answers: 0

    outrageous sentence

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    There are two different options:

    Regards,
    Allan

  • jy95jy95 Posts: 5Questions: 1Answers: 0

    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 ?

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin
    Answer ✓

    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

  • jy95jy95 Posts: 5Questions: 1Answers: 0

    Thanks , I hope one day it may be work with ajax source.

This discussion has been closed.