Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable export to csv support #263

Closed
gatapia opened this issue Apr 27, 2016 · 1 comment
Closed

DataTable export to csv support #263

gatapia opened this issue Apr 27, 2016 · 1 comment
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@gatapia
Copy link
Contributor

gatapia commented Apr 27, 2016

It would be great to have a 'toCsv' method on the table. This would export headers and table contents to a csv file. I currently hacked this using jQuery but it should be contained within the table itself I think.

So this would work as follows:

# template
<p-datatable #table>...</p-datatable>
<button (click)="tocsv(table.toCsv())">Export to CSV</button>

# component
tocsv(csv: string) {
  // Server needs to "download" csv file to browser for IE9 support
  http.post('tocsv', {data: csv});
}

I send the csv to the server so the server creates a temporary file to send the the browser. However, it appears that this may be possible in pure JS: stack overflow

This would be even better (as long as IE9 is supported).

@cagataycivici
Copy link
Member

Great idea, we'll check this. Thanks. In PrimeFaces, we can export to pdf, csv, xml and excel so PrimeNG should have some sort of export as well.

@cagataycivici cagataycivici added the Type: New Feature Issue contains a new feature or new component request label May 5, 2016
@cagataycivici cagataycivici changed the title [New Feature] DataTable export to csv support DataTable export to csv support May 5, 2016
@cagataycivici cagataycivici added this to the 1.0.0-beta.5 milestone May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

3 participants