Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda