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.
newbieC
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
Data export in json format works proper unlike csv/pdf format, which only prints one single random row to the file.
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
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?
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
andpageSize
options of thepdfHtml5
button and be used to control them.Allan
Thanks Allan, orientation did not prove useful but ultimately using pagesize:"A0" worked.