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

281
Vistas
Javascript Bootstrap Multiselect - Show search dropdown if no options available

I'm using bootstrap-multiselect (https://github.com/davidstutz/bootstrap-multiselect) and want to dynamically load the data similar to bootstrap multiselect search get value from database, but on initial start there are no option values available, then by default the search dropdown is not showing. How can I still open/show the search dropdown if no options are available? Here is a fiddle: https://jsfiddle.net/mwd4ag3h/

html:

<select id="example-getting-started" multiple="multiple"></select>

js:

$('#example-getting-started').multiselect({
    enableFiltering: true,
    includeFilterClearBtn: true,
    enableCaseInsensitiveFiltering: true
});

/* Here you have a search field */
var data_loader = [
    { label: "Dashboard", value: 1 },
    { label: "Email", value: 2 }
];

/* Here you don't have a search field */
var data_loader_empty = [];

$('#example-getting-started').multiselect('dataprovider', data_loader_empty);
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

A possible solution is to add an element to the multiselect and then hide the list item

let $select = $('#example-getting-started').multiselect({
  //includeSelectAllOption: false,
  enableFiltering: true,
  includeFilterClearBtn: true,
  enableCaseInsensitiveFiltering: true
});
var data_loader = [{label:'', value:''}];
$('#example-getting-started').multiselect('dataprovider', data_loader);
$('.multiselect-container li').hide();
about 4 years ago · Santiago Gelvez 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