RadzenDropDown doesn't display values inside the dropdown when cleared when using AllowVirtualization #1111

Closed
opened 2026-01-29 17:49:05 +00:00 by claunia · 2 comments
Owner

Originally created by @egans146 on GitHub (Jan 30, 2024).

Describe the bug
When a RadzenDropDown with AllowVirtualization is provided a value before the user selection and the value is cleared, the dropdown doesn't display any values when opened.

<RadzenDropDown @bind-Value=Value
                Data="items"
                Count="itemCount"
                LoadData="OnLoadData"
                AllowFiltering=true
                AllowClear=true
                TextProperty="@nameof(Item.Value)"
                AllowVirtualization=true />

@code {
    class Item(string value) { public string Value { get; } = value; };

    RadzenDataGrid<Item> grid;

    int itemCount = 1000;

    IReadOnlyList<Item> itemSource;
    Item Value;

    protected override void OnInitialized()
    {
        var charset = "abcdef ".ToCharArray();
        var items = Enumerable.Range(0, itemCount)
            .Select(e =>
            {
                Random.Shared.Shuffle(charset);
                return new Item(new string(charset));
            })
            .ToArray();
        itemSource = items;
        Value = items.First();
    }

    IEnumerable<Item> items;

    void OnLoadData(LoadDataArgs args)
    {
        IEnumerable<Item> query = itemSource;

        if (args.Filter != null)
            query = query.Where(e => e.Value.Contains(args.Filter));

        itemCount = query.Count();
        items = query.Skip(args.Skip ?? 0).Take(args.Top ?? 10).ToArray();
        StateHasChanged();
    }
}

In the example, if the dropdown is opened prior to clearing the value, the dropdown shows the values as intended.

Animation

Desktop:

  • OS: Windows
  • Browser: Brave
  • Version 4.24.4
Originally created by @egans146 on GitHub (Jan 30, 2024). <!-- IMPORTANT: Read this first!!! 1. If you own a Radzen Professional or Еnterprise subscription you can report your issue or ask us a question via email at info@radzen.com. Radzen staff will reply within 24 hours (Professional) or 16 hours (Enterprise) 2. The Radzen staff guarantees a response to issues in this repo only to paid subscribers. 3. If you have a HOW TO question start a new forum thread in the Radzen Community forum: https://forum.radzen.com. Radzen staff will close issues that are HOWTO questions. 4. Please adhere to the issue template. Specify all the steps required to reproduce the issue or link a project which reproduces it easily (without requiring extra steps such as restoring a database). --> **Describe the bug** When a RadzenDropDown with AllowVirtualization is provided a value before the user selection and the value is cleared, the dropdown doesn't display any values when opened. ```razor <RadzenDropDown @bind-Value=Value Data="items" Count="itemCount" LoadData="OnLoadData" AllowFiltering=true AllowClear=true TextProperty="@nameof(Item.Value)" AllowVirtualization=true /> @code { class Item(string value) { public string Value { get; } = value; }; RadzenDataGrid<Item> grid; int itemCount = 1000; IReadOnlyList<Item> itemSource; Item Value; protected override void OnInitialized() { var charset = "abcdef ".ToCharArray(); var items = Enumerable.Range(0, itemCount) .Select(e => { Random.Shared.Shuffle(charset); return new Item(new string(charset)); }) .ToArray(); itemSource = items; Value = items.First(); } IEnumerable<Item> items; void OnLoadData(LoadDataArgs args) { IEnumerable<Item> query = itemSource; if (args.Filter != null) query = query.Where(e => e.Value.Contains(args.Filter)); itemCount = query.Count(); items = query.Skip(args.Skip ?? 0).Take(args.Top ?? 10).ToArray(); StateHasChanged(); } } ``` In the example, if the dropdown is opened prior to clearing the value, the dropdown shows the values as intended. ![Animation](https://github.com/radzenhq/radzen-blazor/assets/6442594/d3ef5044-3c7c-4308-ba46-262e6e493a90) **Desktop:** - OS: Windows - Browser: Brave - Version 4.24.4
Author
Owner

@enchev commented on GitHub (Jan 31, 2024):

Unfortunately I was not able to reproduce this using our demos
dd-async

Maybe I'm doing something wrong?

@enchev commented on GitHub (Jan 31, 2024): Unfortunately I was not able to reproduce this using our demos ![dd-async](https://github.com/radzenhq/radzen-blazor/assets/5804953/5f111fb1-68fa-45ae-a675-dc305e088145) Maybe I'm doing something wrong?
Author
Owner

@egans146 commented on GitHub (Jan 31, 2024):

Thank you for taking the time to investigate the issue.
Here are the steps to reproduce with the example provided:
1: Load the page containing the component.
2: Clear the drop-down value.
3: Open the drop-down.

@egans146 commented on GitHub (Jan 31, 2024): Thank you for taking the time to investigate the issue. Here are the steps to reproduce with the example provided: 1: Load the page containing the component. 2: Clear the drop-down value. 3: Open the drop-down.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1111