When exporting data in csv/pdf format from ajax sourced datatable, incomplete data is exported.

When exporting data in csv/pdf format from ajax sourced datatable, incomplete data is exported.

newbieCnewbieC Posts: 25Questions: 6Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

  ajax:{
        url:'https://restcountries.com/v3.1/all',
        dataSrc: ""
   },

When exporting data, incomplete data is exported to file(only 1 random row of data) instead of all data rows in the table. Why is that and how to fix?

This question has accepted answers - jump to:

Answers

  • newbieCnewbieC Posts: 25Questions: 6Answers: 0

    Data export in json format works proper unlike csv/pdf format, which only prints one single random row to the file.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    It's working as expected in this example.

    Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Colin

  • newbieCnewbieC Posts: 25Questions: 6Answers: 0

    Hey Colin, so I tried again and for some reason it works now. Its exporting all data as expected regardless of page length. Maybe it was just a bug on browser end before.

    Thanks for the help, although I do have a question regarding exporting data to pdf format, since its not displaying all columns. It cuts off columns, maybe the page format(a4 for eg) not letting all columns be printed in pdf format. Is there a fix for that?

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Yes, that is a real problem with the PDF export - it doesn't wrap columns. The only "fix" is either to place the paper into landscape orientation, or use a bigger paper size.

    The orientation and pageSize options of the pdfHtml5 button and be used to control them.

    Allan

  • newbieCnewbieC Posts: 25Questions: 6Answers: 0

    Thanks Allan, orientation did not prove useful but ultimately using pagesize:"A0" worked.

Sign In or Register to comment.