Search code examples
angulartypescriptprimengprimeng-datatable

How to use lazy loading + sort in p-Table using angular2


i have used lazy loading in my application and also i want to use the sorting of the items. If i don't use lazy loading it works fine, but i want the application to work in both lazy loading and sorting. Can anyone help me to solve this.

DEMO:

https://stackblitz.com/edit/angular-ya2md7?file=src%2Fapp%2Fapp.component.html


Solution

  • You cannot sort elements that does not exists. Either load everything, sort and then display, or let your backend serve sorted and paginated data for lazy loading.

    Thats how it normally works (letter option)