Quantcast
Viewing all articles
Browse latest Browse all 4827

Whats the best strategy for letting users download ember-data returns as CSVs?

@Abuelo wrote:

I’m still new to Ember and application development in general and have run into a bit of a break wall. I have a table in my application that uses html/handlebars to print data from a model. I have a requirement that should allow a user to download the table into a CSV file.

I initially tried this with DatatablesJS but that broke the two-way binding between my model and the query params I am using to generate the model which I can’t allow.

I’m not sure what the best strategy is now to allow the user to export this information. I did find this add on but I have been wholly unable to get it to produce a file using the ‘Model’ method in its documentation. I get a bit lost at the end and I am unsure what to do with the

invoiceModel
  .download()
  .then((pdfContent) => this.saveFileAs('invoice.pdf', pdfContent, 'application/pdf'));

I have also seen suggestions that the request for a CSV file should be sent to the backend and have it return through a CSV generator but it seemed very confusing.

I can’t imagine this is a unique requirement, how do other people approach it?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles