Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda