相关疑难解决方法(0)

如何获取仅在分页的材料数据表页面中显示的数据

我需要将页面上当前显示的数据导出为 excel 或 pdf。那么我怎么能得到只显示在页面上的数据。我将整个数据存储在数据源对象中。例如:- 如果每页的项目是 10 ,我需要 10 项目。如果我将分页器项目列表更改为 20,那么我需要 20 个项目。

组件 HTML

   <table mat-table [dataSource]="dataSource" class="mat-elevation-z8 mat_datatable" matSort matSortActive="total_click" matSortDirection="desc" multiTemplateDataRows matSortDisableClear>
Run Code Online (Sandbox Code Playgroud)

组件.ts

   import {MatPaginator, MatSort, MatTableDataSource} from 
  '@angular/material';

   this.dataSource = new MatTableDataSource(this.reports);
   this.dataSource.paginator = this.paginator;
   this.dataSource.sort = this.sort;    
Run Code Online (Sandbox Code Playgroud)

这是我的组件文件。

datatable pagination angular-material angular angular6

2
推荐指数
2
解决办法
2445
查看次数