Skip to content

Instantly share code, notes, and snippets.

@imalberto
Last active December 27, 2015 19:59
Show Gist options
  • Select an option

  • Save imalberto/7380535 to your computer and use it in GitHub Desktop.

Select an option

Save imalberto/7380535 to your computer and use it in GitHub Desktop.
Exporting CSV formatted data from Mojito
exportcsv: function (ac) {
ac.model.get('mydb').fetch(function (err, data) {
var csv = convert2csv(data); // csv is of type string
ac.http.addHeader('content-type', 'application/vnd.ms-excel');
ac.http.addHeader("content-disposition", "attachment; filename=export");
ac.done(csv);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment