Primeng加载图标未更新

时间:2018-02-15 12:27:53

标签: lazy-loading angular5 primeng primeng-datatable

我正在使用具有延迟加载的primeng turbo表并启用加载属性它即使得到更新也没有得到更新

<p-table #dt [loading]="loader" [columns]="cols" [value]="datasource.merchants" [rows]="perPage" [paginator]="true" [pageLinks]="5"
      [lazy]="true" [totalRecords]="datasource.totalCount" (onLazyLoad)="loadLazyData($event)" [exportFilename]="'merchant-list'">
.....

脚本

loadLazyData(event: LazyLoadEvent) {    
    if (event.first !== this.searchParams.offset || event.rows !== this.searchParams.limit) {
      this.loader = true;
      this.searchParams.offset = event.first;
      this.searchParams.limit = event.rows;
     this.apiService.getResponse(this.smartSearchParams.query, event.first, event.rows)
          .subscribe((result) => {
            this.datasource = result;
            let newArray = result.merchants.slice();
            this.dataTable.value = newArray;
            setTimeout(() => {
              this.loader = false;
              this.dataTable.loading = this.loader;
            });
          }, (err: any) => {
            setTimeout(() => {
              this.loader = false;
              this.dataTable.loading = this.loader;
            });
          });

      }

有人可以帮我解决这个问题

1 个答案:

答案 0 :(得分:0)

问题在于changeDetection组件。

我已从我的组件中删除changeDetection:ChangeDetectionStrategy.OnPush并开始工作