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

156
Visualizações
Using filter with slice array methods not working

I have a search input that I use to filter an array of users that are shown in a table. This table includes pagination so I'm using .slice to get 10 users to show on the table per page. For some reason, the search filtering works if I'm on page 1 (guessing because there's no slice on page 1?); after going to another page, the filtering stops working, this is to do with .slice since it works if I remove the .slice code. Any ideas why this is? There's something I'm not seeing here..

tableData() {
      return this.users
        .filter(
          (user) =>
            user.firstName.toLowerCase().includes(this.search.toLowerCase()) ||
            user.lastName.toLowerCase().includes(this.search.toLowerCase()) ||
            user.email.toLowerCase().includes(this.search.toLowerCase()),
        )
        .slice(this.perPage * (this.currentPage - 1), this.perPage * this.currentPage);
    },
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It s because your result is now on the first page or somewhere before.

You are slicing the result.

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