Completed
Last Updated: 25 Dec 2023 13:27 by ADMIN
Release 5.1.0 (31 Jan 2024) (R1 2024)
BlueOcean
Created on: 17 Sep 2020 10:27
Category: ComboBox
Type: Bug Report
6
The popup is not closed when the ComboBox is disabled from code

The popup window is not closed when the ComboBox is disabled from code.

Reproduction code:

 

Selected value: @selectedValue
<br />

<TelerikComboBox Data="@myComboData"
                 TextField="MyTextField"
                 ValueField="MyValueField"
                 Value="selectedValue"
                 ValueChanged="@((int value) => ValueChangedHandler(value))"
                 Placeholder="Select an item..."
                 ClearButton="true"
                 Enabled="@isEnabled"
                 Filterable="true">
</TelerikComboBox>

@code {
    public bool isEnabled { get; set; } = true;
    IEnumerable<MyDdlModel> myComboData = Enumerable.Range(1, 20).Select(x => new MyDdlModel { MyTextField = "item " + x, MyValueField = x });

    int selectedValue { get; set; } = 3; //usually the current value should come from the model data

    public async Task ValueChangedHandler(int value)
    {
        isEnabled = false;
        await Task.Delay(4000); //simulate network delay

        selectedValue = value;

        isEnabled = true;
    }

    //in a real case, the model is usually in a separate file
    //the model type and value field type must be provided to the dropdpownlist
    public class MyDdlModel
    {
        public int MyValueField { get; set; }
        public string MyTextField { get; set; }
    }
}

 

0 comments