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

95
Views
my filter only displays elements with first condition

I don't really know the best way to explain this: I have a list with bases and each base has a list of connectors (it could be one or multiple), I made a filter to filter my bases by connectors, here's what my method looks like:

calcBaseList: function() {
  let tmp = [];
  if (this.filterConnector.length > 0) {
    this.listBase.forEach((base) => {
      if (this.filterConnector.includes(base.connectors[0].standard)) {
        tmp.push(base);
      }
    });
  } else {
    tmp = this.listBase;
  }
  this.filtredBase = tmp;
},

The problem is, when I wanna filter let's say with "connector_base_3" and I have one of my bases that has the "connector_base_3" as one of the connectors but it's not the first one on the list, the base doesn't show up on my filtered list. I tried changing base.connectors[0].standard with base.connectors.standard or base.connectors but it doesn't filter anything in that case

Sorry if my explanation is a bit confusing. Does anyone know how to fix the issue here?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should check all connectors in your filter - not just the first one!

calcBaseList() 
{
  let tmp = [];
  if (this.filterConnector.length > 0) 
  {
    tmp = this.listBase.filter((base) => base.connectors.some(connector => this.filterConnector.includes(connector.standard)));
  } 
  else 
  {
    tmp = this.listBase;
  }
  this.filtredBase = tmp;
},
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!