我有一个从服务填充的数据表,一切正常,除了当我将鼠标悬停在箭头上进行分页时,我会收到此错误
我有:
private int recyclerVisiblePosition;
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState != RecyclerView.SCROLL_STATE_IDLE) {
return;
}
getNewPosition(recyclerView);
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dx == 0 && dy == 0) {
getNewPosition(recyclerView);
}
}
private void getNewPosition(@NonNull final RecyclerView recyclerView) {
final LinearLayoutManager layoutManager = ((LinearLayoutManager)recyclerView.getLayoutManager());
if (layoutManager != null) {
recyclerVisiblePosition = layoutManager.findLastVisibleItemPosition();
}
}
,并且当我从服务中获取数据时也会重置:
ngOnInit() {
this.dataTableSource.paginator = this.paginator;
}
html是:
processedTransactions.subscribe(transactions => {
this.dataTableSource = newMatTableDataSource<DataTableRow(this.dataTableData);
this.dataTableSource.paginator = this.paginator;
this.dataTableSource.sort = this.sort;
})
具有:
<mat-paginator [length]="length"
[pageSize]="pageSize"
[pageSizeOptions]="pageSizeOptions"
>
</mat-paginator>
当我将鼠标悬停在箭头上进行分页时,为什么会出现此错误?
此外,当我对数据进行硬编码时,它仍然会给出相同的错误
答案 0 :(得分:0)
"@angular/cdk": "^7.3.5",
"@angular/material": "^7.3.7",
需要是:
"@angular/cdk": "^7.3.7",
"@angular/material": "^7.3.7",
如果是第一个,您将在数据表的MatTooltip上收到一个神秘的错误