-1

I have requirement to export table where I have presented my custom tables using ngFor.

When I was trying to export each table individually I got wrong result(only one table is exporting for every time) I had taken ViewChildren help.

My Code is like below

<div ngFor="let eachObj of objList:let i=index;">
    <button (click)="exportReport(i)">Export</button>
    <myTable [data]="eachObj"></myTable>
</div>

    @ViewChildren(MyCustomTable) tables: QueryList<MyCustomTable>;
        exportReport(i:number){
        let mytables: MyCustomTable[] = this.tables.toArray();
        mytables[i].exportMyTable('pdf');
   }
Rama Krishna
  • 645
  • 10
  • 28

1 Answers1

0

My approach was right I stuck with something else

Rama Krishna
  • 645
  • 10
  • 28