Skip to content

selectize with maxItems > 1 not hidden on custom bootstrap 5 #2200

@Gildedter

Description

@Gildedter

a selectize with maxItems > 1 is still visible when using a customized bootstrap5 theme, my only customization on bootstrap is adding additional colors for theming

// C# Code
@* Filter Field *@
<div class="row g-3 align-items-center mb-2">
    <div class="col-4">
        <label class="form-label" asp-for="@Model.Items">Items</label>
    </div>
    <div class="col-8">
        <select class="form-select" multiple asp-for="@Model.Items" placeholder="Select Items...">
            @* <option></option> *@
            <option value="0">No Item</option>
            <optgroup label="Other Crate">
                @foreach (var row in Model.ListItems)
                {
                    <option value="@r.Index">
                        @($"{row.Title} {row.Index}")
                    </option>
                }
            </optgroup>
        </select>
    </div>
</div>

...

// js code
$("#ModelItems").selectize({
    plugins: [ "remove_button" ],
    delimiter: ",",
    maxItems: 2,
    closeAfterSelect: false,
});

Image

Image

Image

workarounds: add the hidden property on the original select

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions