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

194
Views
Matrial-UI <Autocompletar /> búsqueda por múltiples parámetros

Empecé a aprender Material UI y tengo una pregunta.

tenemos un objeto

 const top100Films = [ { label: 'The Shawshank Redemption', year: 1994 }, { label: 'The Godfather', year: 1972 }, * ...More items * ]

En este momento, si configuro getOptionLabel = {option => option.label} en mi Autocompletar, solo buscará por etiqueta coincidente (título), por lo que si ingreso un año, es decir, "1994", no mostrará "The Shawshank Redemption" en mi resultados de búsqueda, y si lo configuro en option.year , solo buscará por año y cualquier entrada, excepto el año, no será válida.

Aquí está mi pregunta: ¿Hay alguna forma de configurarlo para que pueda buscar tanto por título como por año?

Solución:

 <Autocomplete ... filterOptions={(options, { inputValue }) => options.filter(item => item.label.toLowerCase().includes(inputValue) || item.year.toString().includes(inputValue) )} />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La API de autocompletar de MUI tiene filterOptions ( documentos aquí ) donde puede configurar un filtrado personalizado.

Lo implementaría algo como:

 <Autocomplete ... filterOptions={(options, { inputValue }) => options.filter(item => item.label.includes(inputValue) || item.year.toString.includes(inputValue) )} />
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!