HalitTalha / ng-material-extensions

Extended features for @angular/material components
Apache License 2.0
101 stars 52 forks source link

Export all data at once, instead of iterating through each page #76

Closed aklauza closed 4 years ago

aklauza commented 4 years ago

I have a big table with 10K rows and 10 cols. The page size is 10 rows.

When using the exporter, it iterates page by page and takes forever to generate the excel file. Is there a way to just call the exporter with this.datasource.filteredData to avoid looping and getting the export fast? Thanks

HalitTalha commented 4 years ago

For huge datasets, you can also consider doing the export server side or else you can inject the appropriate exporter service and call the export method yourself. That way however you won't be able to benefit what cdkExporterDirective provides, like column hiding, being able to export the data as it's shown in html table.

constructor (public exporterService: XlsxExporterService)
...
this.exporterService.export(filteredData);
aklauza commented 4 years ago

The exporterService works. Thank you for your quick response Halit!

El dom., 26 jul. 2020 a las 12:54, Halit Talha TÜRE (< notifications@github.com>) escribió:

Closed #76 https://github.com/HalitTalha/ng-material-extensions/issues/76.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HalitTalha/ng-material-extensions/issues/76#event-3587233381, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW63OB2DSPYO7PVLYQ6KF3R5RNS7ANCNFSM4PIB2L2A .

jimmylevell commented 3 years ago

As recommended I am using the this.exporterService.export approach instead of iterating through the pages. The export is working fine but somehow the export() cannot extract the table headers. So the resulting csv does not have a header row. Is there a way to provide the headers for the export?

HalitTalha commented 3 years ago

As recommended I am using the this.exporterService.export approach instead of iterating through the pages. The export is working fine but somehow the export() cannot extract the table headers. So the resulting csv does not have a header row. Is there a way to provide the headers for the export?

ExporterService.export simply exports whatever you provide as your data. You can add your header row as the first object in your array.

jimmylevell commented 3 years ago

As recommended I am using the this.exporterService.export approach instead of iterating through the pages. The export is working fine but somehow the export() cannot extract the table headers. So the resulting csv does not have a header row. Is there a way to provide the headers for the export?

ExporterService.export simply exports whatever you provide as your data. You can add your header row as the first object in your array.

Thank you a lot for your reply! Working like charm! Thanks a lot!!