HalitTalha / ng-material-extensions

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

Is there a way to manually call the export function? #3

Closed annmarie-switzer closed 5 years ago

annmarie-switzer commented 5 years ago

Is there a way to manually call the export function on the button, so you can do some stuff before the export starts? Something like this:

<button mat-button (click)="myExportFunction()">EXPORT</button>

myExportFunction() {
    doSomething();
    matTableExporterFunction();
}

Great extension!

HalitTalha commented 5 years ago

Many thanks for the feedback. Yes, actually the exportStarted event is emitted just before the real exporting happens. You can listen to that event.

component template <mat-table ......... (exportStarted)="onExportStarted()">

component.ts

   onExportStarted() {
     doSomething();
   }
annmarie-switzer commented 5 years ago

Oh excellent! I did not read the documentation thoroughly enough. Thank you!