Hi Great team
I'm using the community Licence, not yet a paying customer.
If someone could help me with the following issue, I'm not sure if I'm experiencing a bug, or if I'm using the component wrongly.
The issue is with the RadzenDropDown component.
I wrapped that component in my component, and when I pass the existing value, it acts like its value is set to null, and I need to perform an initial search.
Placeholder text is displayed.
However, when I clicked on it and tried searching, I could see that the value was already bound.
Any help would be great!
My code wrapping the RadzenDropDown component looks like this:
@inject IHttpClientFactory _clientFactory
<RadzenDropDown AllowClear="true" Value="@Value" ValueChanged="@( (Customer c) => select(c) )" Placeholder="Pretraga firmi:"
LoadData=@LoadData AllowFiltering="true"
Data=@customers TextProperty="Name" Style="width: 100%; max-width: 400px;"
FilterDelay="200" >
<Template>
@((context as Customer).Pib)--@((context as Customer).Name)--@((context as Customer).City)
</Template>
<ValueTemplate>
@((context as Customer).Name)
</ValueTemplate>
</RadzenDropDown>
@code {
IEnumerable<Customer> customers;
[Parameter] public Customer Value { get; set; }
[Parameter] public EventCallback<Customer> ValueChanged { get; set; }
async Task LoadData(LoadDataArgs args)
{
if (!string.IsNullOrEmpty(args.Filter))
{
//query = query.Where(c => c.CustomerID.ToLower().Contains(args.Filter.ToLower()) || c.ContactName.ToLower().Contains(args.Filter.ToLower()));
HttpClient httpClient = _clientFactory.CreateClient("hrm");
var response = await httpClient.GetFromJsonAsync<IEnumerable<Customer>>($"/api/Customers/?partOfName={Uri.EscapeDataString(args.Filter)}");
customers = response;
}
await InvokeAsync(StateHasChanged);
}
async Task select(Customer customer)
{
Value = customer;
await ValueChanged.InvokeAsync(Value);
}
}