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

161
Vistas
Clear Search value on focus out of a Multiselect - multiselect-react-dropdown (React JS)

I want to clear the search text on focusing out of the multi select field By default onBlur is not provided in the package

By default the search value persists on focus out Search term persisting after focusing out of the field

import { Multiselect } from 'multiselect-react-dropdown';

version: "multiselect-react-dropdown": "^2.0.1"

<Multiselect
options={categoryList} // Options to display in the dropdown
displayValue="name" //Label to be displayed from the object
avoidHighlightFirstOption={true}
// closeIcon="cancel"
emptyRecordMsg={"No Product type available"}
selectedValues={multiSelectedCat && multiSelectedCat.length > 0 ? multiSelectedCat : []} // Preselected value to persist in dropdown
onSelect={multiOnSelectCat} // Function will trigger on select event
onRemove={multiOnRemoveCat} // Function will trigger on remove event />

How can I implement the onBlur functionality as it is not provided by default, and I couldn't find much in docs.

The requirement is to clear the search text on Focus out.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use the ref call back and combine with blur to update inputValue state in Multiselect.

You can see this example: https://codesandbox.io/s/react-playground-forked-kpgmo?file=/index.js

this.multiselectRef = (element) => {
  if (element) {
    $("#search_input").blur(function() {
      setTimeout(function() {
        element.setState({
          inputValue: ""
        });
      }, 1);
    });
  }
};

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