Declined
Last Updated: 23 Mar 2022 11:06 by ADMIN
John af P
Created on: 10 Mar 2022 09:55
Category: ComboBox
Type: Feature Request
2
ComboBox multiple selection support

Hello, I would like to have a mutiselect dropdown like you have for ajax:

https://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/checkboxes/defaultcs.aspx

Syncfusion and radzen have this support for blazor :

https://blazor.syncfusion.com/demos/multiselect-dropdown/checkbox?theme=bootstrap5

https://blazor.radzen.com/dropdown

I know that you have a proposed solution for the MultiSelect component:

CheckBox in Multiselect

But the design of this one is not what I'm after, the box still expands downwards when selecting multiple items and it makes it hard to design a coherent page that does not make the dom "jump around". Also the implementation is cumbersome for more complex objects .

It would be better with a solution like you have for ajax where it just shows the first items that fits and then "+X items".

3 comments
ADMIN
Hristian Stefanov
Posted on: 23 Mar 2022 11:06

Hi John,

The provided way is optimal for this scenario until we implement both features.

I understand why the GetChecked method for nine different multiselects might be boring. Still, this method is needed for the checkbox selection synchronization.

Could you please clarify - what "multiple selectors" mean in this case? The @context inside the ItemTemplate can also provide an object if you have objects as items instead of only strings.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

John af P
Posted on: 16 Mar 2022 14:20

Looks good, but...

I have a page with 9 different multiselects. So the GetChecked for all of them gets a bit boring. And how would this work if you have multiple selectors?

"content: "Selected items: @SelectedProductIDs.Count";" 

 

 

ADMIN
Hristian Stefanov
Posted on: 16 Mar 2022 13:22

Hello John,

The desired functionality is more of an idea for the MultiSelect component. I encourage you to use it instead of the ComboBox.

We already have two feature requests for the checkbox support and the summary tag mode support (not extending the input box while selecting items):

These features will allow you to achieve the desired behavior. I voted for both on your behalf and raised the priority.

In the meantime, you can still achieve the desired result by following the workarounds from the above items. I have prepared for you an example for version above 3.0.0:

<style>
    .single-tag-mode .k-input-values {
        float: left;
    }

        .single-tag-mode .k-input-values .k-chip {
            display: none;
        }

        .single-tag-mode .k-input-values:before {
            content: "Selected items: @SelectedProductIDs.Count";
            display: inline-block;
            line-height: 1.8em;
            padding: 0 7px;
            vertical-align: bottom;
            border: 1px solid rgba(0, 0, 0, 0.08);
            background: #f5f5f5 linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.02));
        }
</style>

<TelerikMultiSelect Class="single-tag-mode" Data="@Roles" @bind-Value="@SelectedProductIDs" Width="300px" AutoClose="false" Placeholder="Write the roles you need">
    <ItemTemplate>
        <input type="checkbox" id="@( "cb" + context.Replace(" ", "") )" class="k-checkbox k-rounded-md k-checkbox-md" checked="@GetChecked(context)">
        @context
    </ItemTemplate>
</TelerikMultiSelect>

@foreach (var item in SelectedProductIDs)
{
    <div>@item</div>
}

@code {
    bool GetChecked(string text)
    {
        return SelectedProductIDs.Contains(text);
    }

    List<string> SelectedProductIDs { get; set; } = new List<string>();

    List<string> Roles { get; set; } = new List<string> {
        "Manager", "Developer", "QA", "Technical Writer", "Support Engineer", "Sales Agent", "Architect", "Designer"
    };
}

Please run it and test to see the result.

I'm also marking this item here as "Declined" as the desired functionality will be available in the future only for the MultiSelect.

If there is anything else we can help with, I'm at your disposal.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.