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

323
Visualizações
Displaying the number of records to display (pagination) in Vue

I have a table with pagination in my Vue project. I have those fields:

  • Field tableItemsPerPage contains the number of items to show per page (10, 25, 50, 100).
  • Field tableCrrentPage contains the current page number.
  • Field items contains the items (array).

I want to display the following message:

Showing 1 to 10 out of 1500 records.
Showing 11 to 20 out of 1500 records.
...

The code:

getRecordsText: function() {
    var records_amount = this.items.length;
    var start = this.tableCrrentPage;
    var end = this.tableCrrentPage;
    return start + " to " + end + " out of " + records_amount + " records";
}

I'm not sure how to calculate start and end based on those fields. Is there a formula I could construct that can show the messages?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

See table below

1 2 3 4
5 6 7 8
9 a b c

here tableItemsPerPage = 4

assuming tableCrrentPage is initially 0

you get

{ start, end } = { start: (tableCrrentPage * 4 ) + 1, end: (tableCrrentPage * 4 ) + 4 }

x= (p, n) => ({ start: (p * n) + 1, end: (p * n) + n })
console.log('10 items per page')
console.log(x(0, 10))
console.log(x(1, 10))
console.log(x(2, 10))
console.log('20 items per page')
console.log(x(0, 20))
console.log(x(1, 20))
console.log(x(2, 20))

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