yogiben / meteor-admin

A complete admin dashboard solution
https://atmospherejs.com/yogiben/admin
GNU General Public License v3.0
826 stars 261 forks source link

Tables appear empty after clicking on a custom link #331

Closed michellarcari closed 8 years ago

michellarcari commented 8 years ago

I created a Collection Item link but the route is set only on the server side to generates a csv string of my collection and stream it back as a text/csv file. When I click that link I get the csv file downloaded but all my collections documents seem to disappear. If I refresh the page, the documents are back.

AdminDashboard.addCollectionItem(function (collection, path) { if (collection === 'Practitioners') { return { title: 'Export to csv', url: path + '/csv' }; } });

And the route:

Router.route('/admin/Practitioners/csv', {where: 'server'}) .get(function () { var fileData = 'my csv string'; var headers = { 'Content-type': 'text/csv; charset=utf-8', 'Content-Disposition': "attachment; filename=practitioners.csv" }; this.response.writeHead(200, headers); return this.response.end(fileData); this.next(); });

michellarcari commented 8 years ago

This is probably working as designed, so I found a workaround that works like a charm.