Open DCSenanayake opened 4 years ago
I have a better PRACTICAL solution for this.
In most of the cases, the
data
is comming fromAPI
.
So, it would be great if we convert the data to csv directly. Yes, It is possible...
Step 1 : npm install @ctrl/ngx-csv
Step 2 : module.ts
@NgModule({
declarations: [
...
...
...
],
imports: [
...
CsvModule,
...
]
})
Step 3 : component.html
<a csvLink [data]="yourDataObject">CSV</a>
Hope you find this solution helpfull :)
Need a export to excel,pdf etc button for ngx-datatable. Because it reduces lots of work in development with ngx-datatables.