0
votes

I am developing a rails application.I am using server side processing and pagination to load data. Adding CSV download only downloads the data displayed on the present page.How to download the whole data?

This is my code(coffee script) $(document).on 'turbolinks:load', -> $('#search-table').dataTable dom: 'lBfrtip' buttons: [ { extend: 'csvHtml5' filename: 'search_results' text: 'Download CSV' className: 'btn-info' exportOptions:{ columns: [0,1,2,3,4,5] } }

1
Show us some code on how you are generating your CSV. - bitsapien
This is raw question. It could have been more explained. But anyways you can select the columns while doing query to prepare the csv data. - Ketan Doshi
i am able to select columns.But can't download the whole data - Teja Rajana

1 Answers

0
votes

I don't use server side processing for my datatables (deferred rendering makes a table of 11K rows fast enough), but I do a lot of fancy processing of fields for the html version, so just exporting the HTML version would not work for me.

I instead setup a .ashx handler page that returns a CSV version of the dataset without the fancy formatting.