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

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