TurboTable with virtual scrolling: Problem with totalRecords
I try to put dynamically totalRecords in my getData function and it doesn't seem to work with virtualscrolling. When I initialize it statically or set it to ngOnInit () it works. With paginator it also works.
Angular version: 5.2.1
PrimeNG version: 5.2.0-RC2
Browser: Chrome 62.0.3202.94 & Firefox ESR 45.2.0
Language: TypeScript 2.6
Node (for AoT issues): node --version = v8.9.4
Same issue here
With DataTable it was possible to update totalRecords after initialization. TurboTable does not allow this anymore. If DataTable is now deprecated in favor of TurboTable, this should be supported.
Something new about this
Same issue here. Without this feature I cannot migrate to TurboTable. In all projects totalRecords it's initialized dynamically when records and total of records are received from request.
Duplicate of https://github.com/primefaces/primeng/issues/5303
Came across the same issue and found out that totalRecords are not getting updated at first . Tried to set totalRecords via the table instance followed by its updateRecord method but it did not help.
Finally did some hack to rerender the view based on a flag value as below <p-table *ngIf = "render" [value]="values" [totalRecords]="totalRecords" ... >
In component
ngOnInit(){
this.totalRecords : number = 0;
this.render : boolean = true;
}
modifyRecords(records){
this.render = false;
this.values = records;
this.totalRecords = records.length;
setTimeout(() => {
this.render = true;
},0);
}
**setTimeout was the key for me , as the flag change needed some delay.
This solution may not be idealistic , but it worked perfectly for me without any performance issue.
https://github.com/primefaces/primeng/issues/5303