primeng table lazy load slower than datatable

UI Components for Angular
Post Reply
yoelz
Posts: 4
Joined: 23 Apr 2017, 08:42

14 May 2020, 07:51

We upgraded our primeng to v9, including changing all p-datatable to p-table,
and now the lazy load (with virtual scroll) takes much more time than it used to ( only first time - scroll works OK).
if loading of 1500 row took about 1-2 seconds, now it takes about 10-20 seconds and more!
no change was done to the onLazyLoad callback.
Can anyone help?

Code: Select all

<p-table #dt [virtualScroll]="virtualScroll" [dataKey]="tableDataKey" [rows]="rows" [paginator]="paginator"
            (onLazyLoad)="loadLazy($event)" [pageLinks]="3" [scrollable]="true" loadingIcon="fa fa-spinner"
            [columns]="columnList" [styleClass]="paginator?'paginator': enableFilter?'scroll filter-table':'scroll'"
            [totalRecords]="virtualScroll?totalRecords:null" [value]="displayList1" [lazy]="virtualScroll"
            [loading]="loading" [resizableColumns]="true" [(selection)]="selectedItem" [expandedRowKeys]="expandedRows"
            (onRowSelect)="onrowSelect($event)" (onRowUnselect)="onRowUnSelect($event)"
            [globalFilterFields]="filterFields"
            [selectionMode]="(enableSelect&&!showSelectColumn)?(multiSelect?'multiple':'single'):''"
            [metaKeySelection]="false" (onHeaderCheckboxToggle)="onHeaderCheckboxToggle($event)"
            (onRowCollapse)="OnRowCollapse($event)">
            
virtualScroll & lazy are true

Code: Select all

loadLazy(event: LazyLoadEvent) {
   
    this.filters = event.filters;
    this.loading = true;
    setTimeout(() => {
      this.loading = false;
      if (this.displayList) {
        this.beforeGlobalFilter();
        let list = this.displayList.filter(row => this.filterField(row, event.filters) && this.globalFilterFileld(row, event.globalFilter));
        this.displayList1 = list.slice(event.first, (event.first + event.rows));
        this.totalRecords = list.length;
      }
    }, 250);
  }

yoelz
Posts: 4
Joined: 23 Apr 2017, 08:42

25 May 2020, 06:41

For anyone who has the same problem:
what we did eventually was to replace all lazy tables withe tables without lazy loading but with pagination,
this works fast for tables with 15000 rows!

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests