Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable - ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'NaNpx'. Current value: '352px' #3041

Closed
rlexa opened this issue Jun 9, 2017 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rlexa
Copy link

rlexa commented Jun 9, 2017

I'm submitting a ...

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior
DataTable with lazy, scrollable and virtualScroll attributes causes the expression-changed in angular2 non-prod and more importantly in karma tests. Additional info: this happens when virtualTableHeight getter starts returning changing values in ScrollableView.html <div #scrollTableWrapper style="position:relative" [ngStyle]="{'height':virtualTableHeight}">.

Expected behavior
Expression-changed shouldn't be thrown in non-prod and karma tests anymore.

Minimal reproduction of the problem with instructions

<p-dataTable [value]="items" scrollable="true" scrollHeight="250px" [rows]="30" virtualScroll="true" lazy="true" [totalRecords]="totalItems" (onLazyLoad)="onLazyLoad($event)">
...

In this scenario karma tests already start failing if the dataTable isn't guarded by some ngIf basically preventing it from showing up altogether while testing.
For non-prod dev testing it is easily reproduced by introducing a checkbox with #someId and binding [scrollable]="someId.checked", then hitting the checkbox (some data should be available I guess to allow for row height calculations inside of the DataTable code).

What is the motivation / use case for changing the behavior?
DataTable with virtual lazy loading is extremely useful, but currently it causes problems due to the strict expression-changed testing in angular ^2.

Please tell us about your environment:
Windows 10 64, npm 5.0.3 + angular cli 1.1.0.

  • Angular version: 4.1.3
  • PrimeNG version: 4.0.3

  • Browser: Chrome

  • Language: TypeScript ~2.3.3

  • Node (for AoT issues): node --version = v6.10.3

@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jun 23, 2017
@cagataycivici cagataycivici added this to the 4.1.0 milestone Jun 23, 2017
@cagataycivici
Copy link
Member

@Mrtcndkn Try writing a setter on total records and directly update the height without binding using the setter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants