0

I am using angular2 with primeng2, pagination is not properly working on dataTable lazyLoad, If click on the specific page or next button it's making API call and getting the response from server but dataTable is not updating immediately

if we click somewhere in the grid it will get updated

If I want to reload the dataTable using reset also not working for me

 this.datasource = result;
 this.datasource.merchants = result.merchants.slice();
/*datasource is an instance of MerchantDto {
  totalCount: number = 0;
  merchants: any = [];
}*/

HTML CODE:

    <p-dataTable #dataTable [loading]="loading" loadingIcon="fa-spinner" [value]="datasource.merchants" [rows]="perPage" *ngIf="datasource"
      [paginator]="true" [pageLinks]="5" [lazy]="true" [totalRecords]="datasource.totalCount" (onLazyLoad)="loadLazyData($event)">
    ......
</paginator>

any idea on this issue

EDIT upgrading to next version might resolve this issue but I want to work on angular2 with primeng2

Satish
  • 537
  • 2
  • 9
  • 21
  • 1
    It is possible that change detection while updating properties is not happening due to which view is not getting refreshed. Read "Change Detection" paraghraph on primeng [documentation](https://www.primefaces.org/primeng/#/datatable) – TimeTraveler Feb 02 '18 at 12:09

0 Answers0