code-for-dc-edu icon indicating copy to clipboard operation
code-for-dc-edu copied to clipboard

export view to CSV

Open HarlanH opened this issue 11 years ago • 2 comments

So that people can download the data underlying what they're looking at

HarlanH avatar Jun 03 '13 12:06 HarlanH

there are relatively straightfoward ways to do this in Chrome, and maybe FF, but it seems like IE is a nonstarter without a server call. We'll want to decided whether to support it only for certain browsers, or wait until we have/need a server.

http://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side http://stackoverflow.com/questions/4639372/export-to-csv-in-jquery

HarlanH avatar Jun 30 '13 19:06 HarlanH

yeah, as far as I can tell, the best "solution" for IE, without a server call, is to print out the data in csv format on a blank page. then user can copy and save the data as csv manually :(

with this bit of extra code (from here http://feras.us/blog/2011/10/25/javascript-to-csv-excel-google-docs-ready-using/)

if (navigator.appName != 'Microsoft Internet Explorer') {
        window.open('data:text/csv;charset=utf-8,' + escape(str));
    }

but it's probably worth implementing this for the other non-IE browsers. It would be a very nice feature.

alternatively, IE users can get a "Print" option instead from a table we dynamically generate.

cherihung avatar Sep 20 '13 06:09 cherihung