p-table virtual scroll errors when adding new rows in v9.1
Posted: 25 Jun 2020, 16:13
Hi,
I'm using the latest v9.1 components in my project, and have been working on a p-table which is bound to a datasource that is expected to change while the table is displayed in a page. Whenever a new record is added to the datasource and the table updates, I'm seeing errors which look like this:
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'height: 37910px'. Current value: 'height: 37944px'.
I have put together a sample in StackBlitz, pls view the console to see the errors:
https://stackblitz.com/edit/primeng-tab ... e-primeng9
In this simple sample the rows do actually get added and the state of the table seems to survive, however in my project's larger and more complicated implementation these errors are more disruptive and the table's scrolling breaks.
While putting that sample together, I originally forked some code from a similar sample which was based on PrimeNG version 6, and with all of my own code remaining exactly the same, these errors are *not* happening in PrimeNG 6:
https://stackblitz.com/edit/primeng-tab ... e-primeng6
I'm not sure if this is a PrimeNG issue, or perhaps an Angular issue, since the versions of both changed between these demos.
Does anyone know how I can resolve this?
Many thanks
Ed
I'm using the latest v9.1 components in my project, and have been working on a p-table which is bound to a datasource that is expected to change while the table is displayed in a page. Whenever a new record is added to the datasource and the table updates, I'm seeing errors which look like this:
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'height: 37910px'. Current value: 'height: 37944px'.
I have put together a sample in StackBlitz, pls view the console to see the errors:
https://stackblitz.com/edit/primeng-tab ... e-primeng9
In this simple sample the rows do actually get added and the state of the table seems to survive, however in my project's larger and more complicated implementation these errors are more disruptive and the table's scrolling breaks.
While putting that sample together, I originally forked some code from a similar sample which was based on PrimeNG version 6, and with all of my own code remaining exactly the same, these errors are *not* happening in PrimeNG 6:
https://stackblitz.com/edit/primeng-tab ... e-primeng6
I'm not sure if this is a PrimeNG issue, or perhaps an Angular issue, since the versions of both changed between these demos.
Does anyone know how I can resolve this?
Many thanks
Ed