Not Able to use VirtualScroll Pagination After Performing server side Sorting.

UI Components for Angular
Post Reply
SureshC
Posts: 2
Joined: 23 Sep 2022, 09:15

27 Sep 2022, 11:09

Here is my HTML Code:
``` <p-table styleClass="p-datatable-sm" *ngIf="showTable" [columns]="cols" [value]="dataList"
[scrollable]="true" responsiveLayout="scroll" dataKey="" [(selection)]="selectedList"
[rows]="limit" scrollHeight="250px" [virtualScroll]="true" [virtualRowHeight]="30"
selectionMode="single" (onRowSelect)="onRowSelect($event)" [lazy]="isLazy"
(onLazyLoad)="loadDataOnLazy($event)" [totalRecords]="totalRecords">

<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field"
[ngClass]="[col.classNames]">
{{col.header}} <span *ngIf="col.isDisabled === false">
<p-sortIcon [field]="col.field"></p-sortIcon>
</span>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr [pSelectableRow]="rowData">
<td *ngFor="let col of columns" [ngClass]="[col.classNames]" class="multiLineQuery">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>```

Here is my ts Code:
```
loadDataOnLazy(event: LazyLoadEvent) {
this.sortColumn = event.sortField;
console.log(this.sortColumn)
event.sortOrder == 1 ? (this.sortOrder = 'ASC') : (this.sortOrder = 'DESC');

if (!this.loadingSearch && this.utility.isNullorUndefined(this.sortColumn)) {
console.log('insdie')
this.search(this.offset + PAGINATION_LIMIT);
}
if (!this.utility.isNullorUndefined(this.sortColumn) && this.loadingSearch) {
console.log('out side')
this.search(0);
}
}

```


Using PrimeNG Version - 13 Please suggest me if any solution

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest