p-table error , ExpressionChangedAfterItHasBeenCheckedError

UI Components for Angular
Post Reply
eloy.silva
Posts: 9
Joined: 03 Apr 2021, 04:24

03 Apr 2021, 04:36

in this code :

Code: Select all

 p-table [value]="datasource"  [lazy]="true" (onLazyLoad)="loadData($event)" [paginator]="true" [rows]="PageSize"
       
        
generates error when using property [lazy] = true

Code: Select all


ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'undefined'. Current value: 'true'.. Find more at https://angular.io/errors/NG0100
  
I would greatly appreciate your help

Thanks

eloy.silva
Posts: 9
Joined: 03 Apr 2021, 04:24

10 Apr 2021, 18:57

the solution i found is:

Code: Select all

import { ChangeDetectorRef, Component, OnInit } from '@angular/core';

Code: Select all


  ngAfterViewInit() {
    this.cd.detectChanges();
  }

ahmtfrkasln
Posts: 1
Joined: 24 Jun 2023, 15:51

24 Jun 2023, 16:23

I implemented basic lazy-load example (without filtering) but unfortunately I get same error because of "loading" property.
https://primeng.org/table#lazy-load

Code: Select all

<p-table [value]="movies" styleClass="p-datatable-striped" [tableStyle]="{'min-width': '50rem'}" [lazy]="true" (onLazyLoad)="loadMovies($event)" [loading]="loading">

Code: Select all

ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'false'. Current value: 'true'. Expression location: ListDataComponent component. 
Thanks for sharing your solution. It has solved my problem but I really don"t understand, why this problem happens and why it has not been solved by primefaces yet.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests