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

110
Vistas
Filter options with conditions JS / VUE

I would like this filter to work, for option "pattern" field description should have params [ok] && field process should have params [pattern]. For option "fast" field description should have params [ok] && field process should have params []. The problem is that the filter is not working when for option "fast" when field description should have params [ok] && field process should have params []. Dont know if the problem is the empty array.

filterConfig() {
      return [
        {
          name: "description",
          field: "description",
          type: "term",
          label: "description",
          options: [
            { label: "pattern", value: "true" },
            { label: "fast", value: "false" },
          ],
          onBeforeLoad(filters, filter) {
            const memo = filters.filter((f) => f.field !== "description");

            if (filter?.params?.length !== 1) return memo;

            if (filter?.params?.includes("true")) {
              memo.push({
                type: "term",
                field: "description",
                params: ["OK"],
              });
              memo.push({
                type: "term",
                field: "process",
                params: ["pattern"],
              });
            }

            if (filter?.params?.includes("false")) {
              memo.push({
                type: "term",
                field: "description",
                params: ["OK"],
              });
              memo.push({
                type: "term",
                field: "process",
                params: [],
              });
            }

            return memo;
          },
        },
      ];
    },
about 4 years ago · Juan Pablo Isaza
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