Last active
December 27, 2015 19:59
-
-
Save imalberto/7380535 to your computer and use it in GitHub Desktop.
Exporting CSV formatted data from Mojito
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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