Completed
Last Updated: 01 Oct 2020 14:09 by ADMIN
Release 2.18.0
JR
Created on: 06 Feb 2020 21:12
Category: MultiSelect
Type: Feature Request
36
Allow selection of multiple items from MultiSelect dropdown at once (AutoClose parameter)

Based on my testing and the online demos, each selection of an item in the dropdown for the Blazor MultiSelect closes the dropdown.

 

Is there a way to keep the dropdown open for the user to make multiple selections? The user could then click outside of the dropdown to close the dropdown.

 

The behavior I am describing is similar to the Kendo UI for jQuery MultiSelect "autoClose" configuration property.

https://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect/configuration/autoclose

3 comments
ADMIN
Marin Bratanov
Posted on: 04 May 2020 14:09

Hi Konrad,

This is not as trivial a feature as it sounds, and what I can offer for the time being is using a grid with multiuple selection in an animation container, something similar to my sample at the end of this thread: https://feedback.telerik.com/blazor/1450105-column-chooser, something like this

@if (customPopupVisible)
{
    <div style="position: fixed; top: 0; bottom: 0; left:0; right: 0; z-index: 2;" @onclick:preventDefault @onclick="@HideItemChooser"></div>
}

<TelerikButton OnClick="@ShowItemChooser">Choose Items</TelerikButton>
<div style="position: relative;">
    <TelerikAnimationContainer Width="300px" @ref="@ItemChooser" Class="k-popup no-headers">
        <TelerikGrid Data=@GridData
                     SelectionMode="GridSelectionMode.Multiple"
                     @bind-SelectedItems="SelectedItems"
                     Pageable="true"
                     Height="400px">
            <GridColumns>
                <GridCheckboxColumn />
                <GridColumn Field=@nameof(Employee.Name) />
                <GridColumn Field=@nameof(Employee.Team) Title="Team" />
            </GridColumns>
        </TelerikGrid>
    </TelerikAnimationContainer>
</div>

@if (SelectedItems != null)
{
    <ul>
        @foreach (Employee employee in SelectedItems)
        {
            <li>
                @employee.Name
            </li>
        }
    </ul>
}

@code {
    TelerikAnimationContainer ItemChooser { get; set; }
    bool customPopupVisible { get; set; }
    async void ShowItemChooser()
    {
        customPopupVisible = true;
        await ItemChooser.ShowAsync();
    }
    async void HideItemChooser()
    {
        customPopupVisible = false;
        await ItemChooser.HideAsync();
    }

    public List<Employee> GridData { get; set; }
    public IEnumerable<Employee> SelectedItems { get; set; } = Enumerable.Empty<Employee>();

    protected override void OnInitialized()
    {
        GridData = new List<Employee>();
        for (int i = 0; i < 15; i++)
        {
            GridData.Add(new Employee()
            {
                EmployeeId = i,
                Name = "Employee " + i.ToString(),
                Team = "Team " + i % 3
            });
        }

        // select Employee with 3 through 5. Not required
        SelectedItems = GridData.Skip(2).Take(3).ToList();
    }

    public class Employee
    {
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }
    }
}

<style>
    .no-headers .k-grid-header{
    display: none;
    }
</style>

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Konrad
Posted on: 02 May 2020 20:11
Is there any workaround for multiple selections?
ADMIN
Marin Bratanov
Posted on: 07 Feb 2020 09:50

Hi JR,

I moved this idea to the Feedback portal so you can Follow its status: https://feedback.telerik.com/blazor/1452680-allow-selection-of-multiple-items-from-multiselect-dropdown-at-once-autoclose-parameter. This will also let the community Vote and comment on it, so we can gauge the public interest in it, which plays a role in setting its priority.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor