Completed
Last Updated: 11 Sep 2022 11:13 by ADMIN
Release 3.6.0 (14 Sep 2022) (R3 2022)
Created by: Svetoslav
Comments: 4
Category: DropDownList
Type: Feature Request
23

Hello everyone,

We have opened this Feature Request to gather your insights on the addition of disabled items for the DropDownList.

For the time being, you can make items look disabled via DropDownListItemTemplate. Also, prevent clicks with @onclick and use the ValueChanged event to skip disabled items during keyboard navigation.

UPDATE: The associated built-in feature is the OnItemRender event, which can help style specific items without a template.

<TelerikDropDownList Data="@Products"
                     TItem="@Product"                     
                     TValue="@(int?)"
                     Value="@SelectedProductId"
                     ValueField="@nameof(Product.Id)"
                     TextField="@nameof(Product.Name)"
                     DefaultText="Select Product..."
                     ValueChanged="@( (int? newValue) => SelectedProductChanged(newValue) )"
                     Width="200px">
    <DropDownListSettings>
        <DropDownListPopupSettings Class="disabled-items" />
    </DropDownListSettings>
    <ItemTemplate>
        @{ var p = context as Product; }
        <div class="item-div @( !p.Active ? "disabled" : "" )"
             @onclick:preventDefault="@(!p.Active)"
             @onclick:stopPropagation="@(!p.Active)">
            @p.Name
        </div>
    </ItemTemplate>
</TelerikDropDownList>

<style>
    /* remove default item padding to prevent selection outside the template div */
    .disabled-items .k-list-item {
        padding: 0;
    }
    /* add back inner padding */
    .disabled-items .item-div {
        padding: 4px 8px;
    }
    /* style disabled items */
    .disabled-items .disabled {
        cursor: not-allowed;
        width: 100%;
        color: #ccc;
    }
</style>

@code {
    private List<Product> Products { get; set; }

    private int? SelectedProductId { get; set; }

    private async Task SelectedProductChanged(int? newValue)
    {
        var newProduct = Products.FirstOrDefault(x => x.Id == newValue);

        if (newProduct?.Active == true || !newValue.HasValue)
        {
            // select only active items or DefaultText
            SelectedProductId = newValue;
        }
        else
        {
            // skip disabled items during keyboard navigation
            var oldProductIndex = Products.FindIndex(x => x.Id == SelectedProductId);
            var newProductIndex = Products.FindIndex(x => x.Id == newValue);

            if (newProductIndex > oldProductIndex)
            {
                // skip forward
                SelectedProductId = Products[++newProductIndex].Id;
            }
            else
            {
                // skip backward
                SelectedProductId = Products[--newProductIndex].Id;
            }
        }
    }

    protected override void OnInitialized()
    {
        Products = new List<Product>();

        for (int i = 1; i <= 7; i++)
        {
            var active = i % 3 != 0;

            Products.Add(new Product()
            {
                Id = i,
                Name = (active ? "" : "Disabled ") + "Product " + i,
                Active = active
            });
        }

        base.OnInitialized();
    }

    public class Product
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public bool Active { get; set; }
    }
}

 

Completed
Last Updated: 22 Apr 2023 15:25 by Felipe
Release 2.24.0
Created by: Ben
Comments: 4
Category: DropDownList
Type: Feature Request
20

Hi,

Is it possible to implement search/look-ahead in the current version of the DropDown component? If not, will you be adding this feature soon?

Thank you.

Ben

Declined
Last Updated: 30 Aug 2023 12:37 by Benjamin
Created by: Robert
Comments: 6
Category: DropDownList
Type: Feature Request
20

The DropDownList component is too basic to be used in complex environments. In the real world, no one is binding DropDownLists to List<string>, they are binding to complex datatypes, and the ability to do so has been present in MVC apps for a long time.

Given the following code, it is possible to bind to a List<object>, and two-way bind to the object that was selected.

	<select @onchange="@OnChangedAsync">
		<option></option>
		@if (DataSource != null)
		{
			@foreach (var item in DataSource)
			{
				<option @key="item" value="@optionValueFunc(item)" selected="@(item.Equals(SelectedItem))">@optionTextFunc(item)</option>
			}
		}
	</select>
	#region Private Members

	private Func<TSource, object> optionTextFunc;
	private Func<TSource, object> optionValueFunc;
	private TSource selectedItem = default(TSource);

	#endregion

        #region Public Parameters

	/// <summary>
	/// A List of objects to bind against.
	/// </summary>
	[Parameter]
	public IList<TSource> DataSource { get; set; } = new List<TSource>();

	/// <summary>
        /// A lambda expression referencing the property containing the text to display to the end user. Example: @(c => c.DisplayName)
        /// </summary>
        [Parameter]
        public Expression<Func<TSource, object>> OptionText { get; set; }

	/// <summary>
        /// A lambda expression referencing the property containing the value for this object, usually an identifier. Example: @(c => c.Id)
        /// </summary>
        [Parameter]
        public Expression<Func<TSource, object>> OptionValue { get; set; }

	/// <summary>
        /// The item from the <see cref="DataSource" /> that has been selected.
        /// </summary>
        [Parameter]
        public TSource SelectedItem { get; set; }

	/// <summary>
	/// The callback event required for two-way binding.
	/// </summary>
	[Parameter]
        public EventCallback<TSource> SelectedItemChanged { get; set; }

        #endregion

	private async Task OnChangedAsync(ChangeEventArgs changeEventArgs)
        {
            await UpdateSelection(DataSource.FirstOrDefault(c => optionValueFunc(c).ToString() == changeEventArgs.Value.ToString()));
        }

	private async Task UpdateSelection(TSource item)
        {
            selectedItem = item;
            await SelectedItemChanged.InvokeAsync(selectedItem);
        }

	protected override async Task OnInitializedAsync()
	{
            if (optionTextFunc == null && OptionText != null)
            {
                optionTextFunc = OptionText.Compile();
            }
            if (optionValueFunc == null && OptionText != null)
            {
                optionValueFunc = OptionValue.Compile();
            }
            await Task.CompletedTask;          
        }

Would really appreciate it if you would consider adding this to the next release.

Completed
Last Updated: 08 Feb 2023 23:19 by Ted
Created by: Marcel
Comments: 7
Category: DropDownList
Type: Feature Request
19

Right now when a DropDownList has PopupHeight="Auto" the popup gets the height necesaary to display its items properly.

But when there are many items the popup also displays all items without a vertical scrollbar (maybe over the entire page and beyond), which is not good.

 

My suggestion would be to add a property for specifyig a "MaxPopupHeight" to limit the growth of the popup.

Also if "PopupHeight" is not specified it should take "Auto" as the default value instead of a static height in px, instead give the new "MaxPopupHeight" a limiting default value.

***Admin Edit***

Released in 3.0.0 through PopupSettings tag: https://docs.telerik.com/blazor-ui/upgrade/breaking-changes/3-0-0#popup-settings

***Admin Edit***

Unplanned
Last Updated: 29 Nov 2023 23:29 by Adam

At the moment, typing with the keyboard focuses the first item that starts with the last letter you pressed. To focus the next one you should either use Down Arrow, or type the same letter again.

I would like it to behave like the regular <select> or like a combo box with filtering - typing characters quickly should highlight the item that begins with all those characters, instead of using only the first letter.

=== 

Admit edit: some keywords for better findability: DropDownList keyboard search filter accessibility

Completed
Last Updated: 22 Jul 2022 12:41 by ADMIN
Release 3.5.0

Is it possible to drop dropDownList from outside, for example after its data has been changed, without clicking on it ?

ADMIN EDIT:

This feature is also applicable to ComboBox, AutoComplete, Multiselect, Date and Time Pickers components.

Unplanned
Last Updated: 11 Jan 2021 17:39 by ADMIN
Created by: Wei
Comments: 0
Category: DropDownList
Type: Feature Request
9
I would like a boolean AutoWidth parameter that controls the width of the popup element of the dropdown and adjust its width based on the data. 
Unplanned
Last Updated: 17 Jun 2022 18:04 by Randy
Created by: NO
Comments: 2
Category: DropDownList
Type: Feature Request
8

Hello,

would it be possible to add "OnFocus" event to DropDownList as there is already "OnBlur" event?

Thanks

Unplanned
Last Updated: 08 Feb 2023 13:23 by Sébastien
Created by: Sébastien
Comments: 0
Category: DropDownList
Type: Feature Request
8
I would like to define a template for the main element of the DropDownList when no value is selected. I want to be able to add other content apart from the default text - for example, an icon.
Duplicated
Last Updated: 18 Dec 2020 09:51 by ADMIN
Created by: Cindy
Comments: 2
Category: DropDownList
Type: Feature Request
6
Completed
Last Updated: 03 Jul 2019 11:47 by ADMIN
Release 1.3.0
Created by: Andrew
Comments: 0
Category: DropDownList
Type: Feature Request
5

Posting this feature request as per your suggestion in my original forum post at: https://www.telerik.com/forums/data-source-using-scalar-list

I would like the DropDownList component to support lists of scalar values as data source. I.e:


<TelerikDropDownList Data="@MyList" bind-Value=@MyItem>

</TelerikDropDownList>
 
@functions {
    protected List<string> MyList = new List<string>() { "a", "b", "c" };
 
    protected string MyItem { get; set; } = "b";
}

The DropDownList would infer the scalar type from the Data property. The TextField items shown in the list (and the associated ValueField) would be the same: i.e. the value of each scalar in the list.

Declined
Last Updated: 08 Feb 2023 23:18 by Ted
Created by: Marcel
Comments: 2
Category: DropDownList
Type: Feature Request
5
 if "PopupHeight" is not specified it should take "Auto" as the default value instead of a static height in px

This will allow the dropdown to be large enough to fit a reasonable number of items without a scrollbar. Alternatively, you could limit it through a pixel value you can set, or through the MaxPopupHeight property if it gets implemented: https://feedback.telerik.com/blazor/1412653-maxpopupheight.

Completed
Last Updated: 16 Apr 2020 07:53 by ADMIN
Release 2.11.0
Created by: OnSemble
Comments: 2
Category: DropDownList
Type: Feature Request
5
I had the same issue in general on Blazor with a text box, they are fixing this in 3.1 https://github.com/aspnet/AspNetCore/issues/11914. There is a workaround and I have confirmed that textboxs on 3.1 textboxes work without the workaround. I'm doing a trial of Telerik's Blazor components and noticed the same validation issue existed so I had to put back in the workaround to fix it. It would be nice if this workaround wasn't required.
Unplanned
Last Updated: 04 Apr 2023 14:25 by Chris
Created by: Chris
Comments: 0
Category: DropDownList
Type: Feature Request
4

I need to be able to allow our users to tab into the dropdownlist control and open it with enter (similar to standard HTML select).

Here is also a sample from the W3 documentation to compare against: DropDownList keyboard support.

Completed
Last Updated: 08 Jan 2020 16:13 by ADMIN
Release 2.6.0
The idea is that the hint text (like "choose a product from the dropdown") and the default value the component will have, should be independent of the model it is bound to. This simplifies providing such a value and better supports view-model scenarios where the validation happens in the view-model and the actual model may not even be able to take the same values, because it relies on app logic to protect it.

The most obvious example is a required field - it must be nullable so required validation works, but the actual model may have to be non-nullable.
Completed
Last Updated: 03 Jul 2023 12:05 by ADMIN
Release 4.4.0 (07/19/2023) (R3 PI1)
Created by: Sarah
Comments: 0
Category: DropDownList
Type: Feature Request
3
I want to add default text within the search bar filter of the DropDownList (eg. "Search by number or name"). I do not want this to show up as the value field - only in the textbox of the search bar. 
Unplanned
Last Updated: 03 Apr 2024 21:07 by Nicholas

Currently, a TextField value of empty string will produce a blank item in the dropdown.

On the other hand, a null TextField value will produce the fully qualified class name.

Here are possible workarounds: https://blazorrepl.telerik.com/myOlFpFb1465jW8E07

Completed
Last Updated: 10 Jan 2020 13:50 by ADMIN
Release 2.6.0
Created by: Michael
Comments: 3
Category: DropDownList
Type: Feature Request
1

As stated in the documentation the Event OnChange for DropDownList is shown by intellisense but should not be used. However, in some situations it would be very useful to bind the value of the DropDownList and additionally have an event when the value changes, e.g. show additional inputs when a value is selected.

 

Currently it is either possible to have data binding to value by @bind-Value or listen for the changed event by using Value and ValueChanged.

Unplanned
Last Updated: 22 Mar 2024 10:30 by n/a
Created by: n/a
Comments: 0
Category: DropDownList
Type: Feature Request
1
Most of the select components (e.g. ComboBox, MultiSelect) have a loading indicators in the popup that appear while the data is loading. Please add such a loading skeleton animation in the DropDownList component, too.
Unplanned
Last Updated: 15 May 2024 07:19 by ADMIN
Created by: Lennert
Comments: 0
Category: DropDownList
Type: Feature Request
1

Hi,

We are using the DropDownList component as an inline editor in the grid, for managing a product hierarchy. Previously we were using the DropDownList with grouping enabled, without virtualization, but due to volume of data we now need to use virtualization.
This does not work with grouping at the moment.

At the bottom of this page it is mentioned that 'Virtual scrolling with grouping will be supported in a future version.'.

Any timeline on this feature?

KR,

Lennert

1 2