Add a scroll bar in multiselect

Asked

Viewed 30 times

0

I want to put a scroll bar in a multiselect, only I still can’t figure out how to do it :/

I have the following code:

HTML

<div class="col-md-2">
    <label>Teste</label><br />
    <select id="teste" class="multiselect-ui form-control" multiple="multiple" data-toggle="tooltip" title="Teste">
        @foreach (var item in listaTeste)
        {
        classHtml = "";
        if (listaIdsTestes.Contains(item.Id))
        {
        classHtml = "selected ";
        }
        <option value="@item.Id" @classHtml>@item.Abreviatura</option>
        }
    </select>
    <input type="hidden" id="txTeste" name="txtTeste" value="@ViewBag.TxtTeste" />
</div>

javascript

$('#teste').multiselect({
    includeSelectAllOption: true,
    nonSelectedText: 'Testes',
    selectAllText: 'Seleccionar Todos'
});

I leave a picture of how to find the element inserir a descrição da imagem aqui

Does anyone know what I might be missing?

  • What do you mean? It already has scrollbar by default.

  • @Sam what happens is that when I open the multiselect it opens the hundreds of options I have, which makes its size (height) to fit all the options :/

  • I’m sorry, but I can’t understand what you want to do.

  • @Sam put an image on top to see if it helps to understand the problem. As you can see, I don’t want when you open the multiselect to choose the values, that this is so big. My goal is to put a scroll and decrease the size of this component

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.