Fill SfAutoComplete data source on demand in Blazor
I am not able to add datasource on demand in Blazor App following is my code please check what's going wrong.
<SfAutoComplete @ref="autoObj" TValue="string" TItem="BusinessPartner" Placeholder="Customer*" @oninput="OnCardCodeChanged" DataSource="businesspartners" @bind-Value="@statementofAccount.CardName">
<AutoCompleteTemplates TItem="BusinessPartner">
<ItemTemplate>
<span><span>@((context as BusinessPartner).CardCode)</span><span>@((context as BusinessPartner).CardName)</span></span>
</ItemTemplate>
</AutoCompleteTemplates>
<AutoCompleteFieldSettings Text="CardName" Value="CardName"></AutoCompleteFieldSettings>
<AutoCompleteEvents TValue="string"></AutoCompleteEvents>
</SfAutoComplete>
@code{
private async Task OnCardCodeChanged(ChangeEventArgs e)
{
if (e.Value.ToString().Length == 3)
{
var respone = await SAPClient.Data.SAPConnectServices.GetBusinessPartner(e.Value.ToString());
if (respone.IsSuccessStatusCode)
{
jsonString = await respone.Content.ReadAsStringAsync();
var responseBusinessPartner = JsonConvert.DeserializeObject<APIResponse>
(jsonString);
businesspartners = responseBusinessPartner.BusinessPartners;
autoObj.Refresh();
}
}
}
}
SIGN IN To post a reply.
2 Replies
1 reply marked as answer
PM
Ponmani Murugaiyan
Syncfusion Team
January 26, 2021 12:27 PM UTC
Hi syed,
Greetings from Syncfusion support.
Currently we are checking the reported query. We will check and update further details in 2 business days (January 28, 2021). We appreciate your patience until then.
Regards,
Ponmani M
SP
Sureshkumar P
Syncfusion Team
February 1, 2021 12:33 PM UTC
Hi Syed,
Thanks for your patience,
Based on your shared information, we suspect that you want to load the popup suggestion based on searched character (more than or equal to length 3). So, we suggest you use our MinLength property to achieve your requirement. if you did not want to use the MinLength property then you can also achieve this custom filtering behavior using our filter event.
To know more about our custom filtering action and SuggestionCount. please refer the below documentation link.
Documentation link for custom filtering: https://blazor.syncfusion.com/documentation/autocomplete/filtering/#custom-filtering
Regards,
Sureshkumar P
Marked as answer
SIGN IN To post a reply.
- 2 Replies
- 3 Participants
- Marked answer
-
SI syed ibadurrab
- Jan 22, 2021 11:00 AM UTC
- Feb 1, 2021 12:33 PM UTC