我正在尝试让虚拟滚动为 TreeTable 工作,并且在按照我ExpressionChangedAfterItHasBeenCheckedError
为我的数据展开任何节点时得到的官方示例之后。
当尝试使用 Stackblitz 进行官方演示时,我看到这里也产生了错误,primeng v9 和 v10 最新的演示示例都发生了这种情况。
我注意到这里也提出了一个 GitHub 问题 - https://github.com/primefaces/primeng/issues/8886但已关闭并引用了一种解决方法来ChangeDetectorRef
手动添加 a 并触发更改检测周期。
我用官方的 stackblitz 演示(https://stackblitz.com/edit/primeng-treetablescroll-demo?file=src%2Fapp%2Fapp.component.ts)尝试了这个解决方案
setTimeout(() => {
this.virtualFiles = Array.from({length: 1000}).map((_,i) => this.createNode(i, 100));
this.cd.detectChanges();
}, 2000);
但这没有区别,仍然会产生错误,也许我执行不正确?
要复制此问题,您只需展开虚拟滚动示例中显示的节点之一。
我对primeng 9的解决方案\解决方法特别感兴趣