Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Here I struggle with refresh data source issue:
this is the razor component:
@using Syncfusion.Blazor.DropDowns
@using Syncfusion.Blazor.Popups
@using System.Collections.ObjectModel;
@inject ISecurityService SecurityService
<div >
<SfTooltip @ref="TooltipObj" ID="Tooltip" Target=".e-list-item .name[title]">
</SfTooltip>
<SfComboBox @ref="comboBoxObj" TItem="EmployeeFullDetailsSearch" TValue="string" AllowFiltering="true" DataSource="@EmployeesTry">
<ComboBoxEvents TItem="EmployeeFullDetailsSearch" TValue="string" OnClose="OnClose" Opened="OnOpen" Filtering="@OnTypingComboBoxAsync" OnValueSelect="@chooseEmployee"></ComboBoxEvents>
<ComboBoxFieldSettings Text="FullName" Value="FullName"></ComboBoxFieldSettings>
</SfComboBox>
</div>
when typing in the combo box I want to bring new items from my DB (total items 1200K and I don't want to bring all at once).
but it's not working, I don't see the new results in the comboBox I see "NO RECORDS FOUND" but i can see i have items in my EmployeesTry , and it seems the problem is because of async await cause I tried hard code as your example and it worked but bringing new items from DB don't.
I tried both List and ObservableCollection both didn't work.
I also tried to add a ref to the SfComboBox but it didn't work also.
@code {
[Parameter]
Participants participant { get; set; }
[Parameter]
public ObservableCollection
[Parameter]
public GridInjector Injector { get; set; }
[Parameter]
public EventCallback
[Parameter]
public EventCallback
public ObservableCollection
SfTooltip TooltipObj;
SfComboBox<string, EmployeeFullDetailsSearch> comboBoxObj;
public Boolean isOpen { get; set; } = false;
private bool intelMode;
protected override async Task OnInitializedAsync()
{
EmployeesTry = new ObservableCollection
}
protected override void OnParametersSet()
{
base.OnParametersSet();
Injector.CompanyChanged = CompanyCheck;
CompanyCheck(participant.CompanyName);
}
private void CompanyCheck(string name)
{
intelMode = name == "Intel";
StateHasChanged();
}
public void OnOpen(PopupEventArgs args)
{
isOpen = true;
}
public void OnClose(PopupEventArgs args)
{
TooltipObj.CloseAsync();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (isOpen)
{
await TooltipObj.RefreshAsync();
}
}
private async Task OnTypingComboBoxAsync(FilteringEventArgs args)
{
//await GetEmployees(args.Text);
EmployeesTry.Clear();
StateHasChanged();
var result = await SecurityService.GetEmployeeSearch(args.Text);
foreach (var item in result)
{
EmployeesTry.Add(item);
}
await comboBoxObj.RefreshDataAsync();
StateHasChanged();
}
how can I solve this?