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

109
Visualizações
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 Respostas
Responde à pergunta

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