Angular 6 MatTable Performance in 1000 rows.

前端 未结 7 852
無奈伤痛
無奈伤痛 2020-12-03 04:56

I\'m using angular material in my project and I\'m using Mat-Table to render 1000 Product/row per table. When Change pagination (we use backend pagination) of table to 1000

7条回答
  •  天涯浪人
    2020-12-03 05:51

    I have found the paginator and sort to sometimes not work.

    What has worked for me with over 2000 rows was:

     ngAfterViewInit() {
          setTimeout(() => {
              this.getLargeDataSet.subscribe(largeDataSet => {
                  this.dataSource.paginator = this.paginator;
                  this.dataSource.sort = this.sort;
                  this.dataSource.data = largeDataSet;
              });
          });
     }
    

    Supper fast, from 10+sec to 2sec :0

提交回复
热议问题