Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
correct implementation of datasource pagination

So at first page it shows the corrrect display

enter image description here


But when I click next page it is displaying , it it displaying 21-20 of , which is wrong.

enter image description here

enter image description here

#html code that uses the component add passes the prefix text and suffix text

<app-table-paginator-text [dataSource]="dataSource" [prefixText]="'Showing'" [suffixText]="'results'"></app-table-paginator-text>  

#data source html code

<div id="table-paginator-text" class="secondary-text" *ngIf="dataSource.paginator !== undefined">
  {{prefixText}} {{(dataSource.paginator.pageIndex === 0)? 1: (dataSource.paginator.pageSize * dataSource.paginator.pageIndex) + 1 }} - {{this.dataSource.connect().value.length}} of {{dataSource.data.length}} {{suffixText}}      
</div>    
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

In your data source code, you are correctly offsetting the left-hand number by the pageSize, but the right-hand side is simply the length of the current set. You need to add the offset there, too. I think the following should do it:

(dataSource.paginator.pageSize * dataSource.paginator.pageIndex) + this.dataSource.connect().value.length
about 4 years ago · Juan Pablo Isaza Report

0

Try:

<div id="table-paginator-text" class="secondary-text" *ngIf="dataSource.paginator !== undefined">
  {{prefixText}} {{(dataSource.paginator.pageIndex === 0)? 1: (dataSource.paginator.pageSize * dataSource.paginator.pageIndex + 1)}} - {{dataSource.paginator.pageSize * dataSource.paginator.pageIndex + this.dataSource.connect().value.length}} of {{dataSource.data.length}} {{suffixText}}      
</div>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!