Datatable: Virtual Scroll Lazy
Describe the bug
When using the primeng table with virtual scrolling and lazy loading enabled, the following error is thrown when the first new data was loaded:
Error message
core.mjs:10920 ERROR TypeError: Cannot read properties of null (reading 'scrollTop') at Scroller.onScrollPositionChange (primeng-scroller.mjs:723:53) at Scroller.onScrollChange (primeng-scroller.mjs:770:65) at primeng-scroller.mjs:804:22 at timer (zone.js:3084:47) at _ZoneDelegate.invokeTask (zone.js:450:35) at core.mjs:27127:55 at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:27127:36) at _ZoneDelegate.invokeTask (zone.js:449:64) at Object.onInvokeTask (core.mjs:27437:33) at _ZoneDelegate.invokeTask (zone.js:449:64)
The error seems to happen because of the timeout in "onContainerScroll":
event.target is null there, leading to an error down the line:
Environment
Running in angular 16 with node 18.15.0 ShadowDom is enabled on the Component using the table
Reproducer
https://stackblitz.com/edit/epnkmf?file=src%2Fapp%2Fdemo%2Ftable-virtual-scroll-lazy-demo.ts
Angular version
16.2.2
PrimeNG version
16.3.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.15.0
Browser(s)
Chrome 116
Steps to reproduce the behavior
No response
Expected behavior
No response
EDIT: add reproducer based on the example in the documentation
Is there any update on this issue? I face the same problem.
Hi,
So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation and try the latest PrimeNG version(v19). If there is no improvement on this, can you open a new issue so we can include it in our roadmap?
Thanks a lot for your understanding! Best Regards,