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

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

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