Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TurboTable with virtual scrolling: Problem with totalRecords #4979

Closed
RichiKo opened this issue Jan 26, 2018 · 6 comments
Closed

TurboTable with virtual scrolling: Problem with totalRecords #4979

RichiKo opened this issue Jan 26, 2018 · 6 comments
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted

Comments

@RichiKo
Copy link

RichiKo commented Jan 26, 2018

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
@felipebri23
Copy link

Same issue here

@thojo
Copy link

thojo commented Feb 21, 2018

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.

@felipebri23
Copy link

Something new about this

@lukgit17
Copy link

lukgit17 commented Mar 9, 2018

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.

@Abhi-99
Copy link

Abhi-99 commented Mar 14, 2018

Duplicate of #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.

@cagataycivici cagataycivici added the Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted label Mar 27, 2018
@cagataycivici
Copy link
Member

#5303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Projects
None yet
Development

No branches or pull requests

6 participants