I'm currently working on an Angular 4 project and using the PrimeNG DataTable. So far this framework seems pretty neat, but I would like to make my paging server-side. That way I will load only 10,20,.. records at a time rather than loading all 1000+ at once..
Has anyone done this before or does anyone know a solution for this?
PS: If you don't have a solution but know a framework that does support this, please let me know!
FYI, p-dataTable is deprecated in version 6. PrimeFaces suggest you use TurboTable. I just had to go through the conversion. You will need to add [totalRecords]='totalRecords' [lazy]='true' (onLazyLoad)='loadPatientLazy($event)' [loading]='loading'
Note: nsg- CSS classes are my custom classes.
Looks like Lazy is what we are... looking for :) https://www.primefaces.org/primeng/#/datatable/lazy
You could listen for the onPageChange event of the paginator to tell you when you need to get paginator.rows of data
With the help of Lazy Loading, we can implement server side paging, filtering and sorting on the data table.
Here is the code :