Replication code:
@SelectedValue
<br />
<TelerikComboBox Data="@DdoData"
OnRead="@OnReadHandler"
Filterable="true"
ValueField="RecId"
TextField="DdoTitle"
Placeholder="Find what you seek by typing"
@bind-Value="@SelectedValue">
</TelerikComboBox>
@code{
public int SelectedValue { get; set; } = 4;
List<ddo> DdoData { get; set; }
public string ddoCbType { get; set; } = "Default";
int InitialId { get; set; }
string currentText { get; set; } = "";
protected override async Task OnInitializedAsync()
{
await ReadDdoData(ddoCbType, "");
if (SelectedValue > 0)
{
InitialId = (int)SelectedValue;
await ReadDdoData(ddoCbType, currentText);
}
}
async Task OnReadHandler(ComboBoxReadEventArgs args)
{
if (args.Request.Filters.Count > 0)
{
Telerik.DataSource.FilterDescriptor filter = args.Request.Filters[0] as Telerik.DataSource.FilterDescriptor;
currentText = filter.Value.ToString();
await ReadDdoData(ddoCbType, currentText);
}
else
{
currentText = "";
await ReadDdoData(ddoCbType, "");
}
}
private async Task ReadDdoData(string ddoCbType, string currentText)
{
await Task.Delay(100);
DdoData = new List<ddo>()
{
new ddo(){ RecId = 1, DdoTitle = "one"},
new ddo(){ RecId = 2, DdoTitle = "two"},
new ddo(){ RecId = 3, DdoTitle = "Three"},
new ddo(){ RecId = 4, DdoTitle = "Four"},
new ddo(){ RecId = 5, DdoTitle = "Five"}
};
//this does not help
await InvokeAsync(StateHasChanged);
}
public class ddo
{
public int RecId { get; set; }
public string DdoTitle { get; set; }
}
}