角材质虚拟滚动在更新时消失

时间:2019-05-08 13:55:23

标签: angular typescript ngonchanges angular-material-table angular-cdk-virtual-scroll

有一个材料表组件,其中包括虚拟滚动。几秒钟的中断后,我正在尝试进行一些更改和虚拟滚动。

ngOnChanges表组件的钩子:

ngOnChanges(changes: SimpleChanges) {

    this.init();
    this.headers = ["DATE","AMERICA","EUROPE","AUSTRALIA","ASIA"];
    this.displayedColumns = this.headers;

    this.tableDataService.getData()
      .map(data => {
        this.tableData.push(data);

        this._alldata = this.tableData.map((val =>
          val.reduce((headerVal, data, index) =>
            ({ ...headerVal, [this.headers[index]]: data }), {})
        ));

        this.dataSource.allData = this._alldata.slice(0, this.pageSize);
      },
      (err: any) => console.log(err))
  }

stackblitz上再现了这种情况,单击表格上方的按钮,出现了问题。

0 个答案:

没有答案