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

155
Views
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 answers
Answer question

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 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!