Telerik Forums
UI for Blazor Forum
3 answers
30 views

Hello,
i want to bind the autocomplete to a list of object. But the data in the template is empty:

The code is this:


    Kunde:
<TelerikAutoComplete Data="@DataCustomer" TItem="@Customer" ValueChanged="@((string value) => OnComboCustomerValueChanged(value))">
    <ItemTemplate>
        @(nameof(Customer.customerName))
    </ItemTemplate>
    <FooterTemplate>
        <h6>Anzahl: @DataCustomer.Count()</h6>
    </FooterTemplate>
    <NoDataTemplate>
        <div class="no-data-template">
            <TelerikSvgIcon Icon="@SvgIcon.FilesError" Size="@ThemeConstants.SvgIcon.Size.Large"></TelerikSvgIcon>
            <p>No items available</p>
        </div>
    </NoDataTemplate>
</TelerikAutoComplete>



protected override async Task OnInitializedAsync()
{
    List<Customer> customers = new List<Customer>();
    customers.Add(new Customer()
        {
            customerId = "",
            customerName = ""
        });

    DataCustomer = customers;
}

 private void OnComboCustomerValueChanged(string value)
 {
     ComboCustomerValue = value;

     if (value != null && value.Length > 3)
     {
         if (DataCustomer == null)
         {
             List<Customer> Data = new List<Customer>();
         }

         if (DataCustomer.FirstOrDefault(item => item.customerId == value.ToString()) == null)
         {
             IO.Swagger.Api.CustomerApi customerApi = new IO.Swagger.Api.CustomerApi("https://server:8080");
             foreach (var itemsFound in customerApi.ApiV1CustomerIdGet(Convert.ToInt32(value)))
             {
                 if (DataCustomer.FirstOrDefault(item => item.customerId == itemsFound.Id.ToString()) == null)
                 {
                     DataCustomer.Add(new Customer()
                         {
                             customerId = itemsFound.Id.ToString(),
                             customerName = itemsFound.Name + @" (" + itemsFound.Id.ToString() + @")"
                         });
                 }
             }

         }
     }
 }

What have i made wrong?

Kind regards
Jens

Jens
Top achievements
Rank 1
Iron
Iron
 answered on 12 Apr 2024
0 answers
24 views
As of now, the OnChange event of the AutoComplete component is triggered upon pressing the Enter key or losing focus of the input. In order to only produces changes upon pressing Enter, I use the OnBlur event to change specific boolean values (e.g isInputFocused) so as to modify the behaviour of OnChange conditionally. Is OnBlur always triggered before OnChange? In the future, will a new event be added to the TelerikAutoComplete component which is triggered only upon pressing the Enter key?
Ricardo
Top achievements
Rank 1
Iron
 asked on 04 Mar 2024
1 answer
44 views

Hi, I want to be able to open the dropdown of the AutoComplete component upon focus of the input field.
I found this can be done with a workaround using Js interop:
https://docs.telerik.com/blazor-ui/knowledge-base/inputs-open-programmatically

However, I feel this functionality should be supported out of the box through some 'OpenOnFocus' parameter on the component.
It would be a very welcome improvement!

Kind regards,

Lennert

Georgi
Telerik team
 answered on 15 Dec 2023
1 answer
164 views

I need to disable the browser's autofill option on our Blazor Autocomplete. How can I accomplish this?

THanks

Billy

Georgi
Telerik team
 answered on 26 Oct 2023
1 answer
48 views
Tried setting the Value but the textbox refuses to change the displayed text. 
Georgi
Telerik team
 answered on 29 Sep 2023
1 answer
303 views
I am using the below input utilizing the ValueChanged Event to query data results from the backend to populate the list.

In different cases I need to clear the selected value from other Methods, but after it's selected, the only way to clear it is to use the "X" in the autocomplete input.

I saw threads stating to clear the @bind-Value="Model.Property" to clear it. But, when using value changed, it will not let me set @bind-Value, I must use ValueExpression lamda.

My question is, how can I clear this value from my blazor CodeBehind?

Input

                <TelerikAutoComplete Class="@(this.ProviderSearch.IsUsingMyLocation ? "my-location-on":"my-location-off")" Placeholder="@this.ProviderSearch.SelectedAutocompleteLocation" Data="@this.AutocompleteSuggestions" TItem="Prediction" ValueField="Description" OnChange="@this.OnAutoCompleteSelectedHandler" ValueChanged="@( (string newValue) => OnAutoCompleteValueChanged(newValue) )" ValueExpression="(() => this.ProviderSearch.SelectedAutocompleteLocation)" />
Georgi
Telerik team
 answered on 26 Sep 2023
1 answer
66 views
In .NET 8, Microsoft will be introducing support for IAsyncEnumerable JSON deserialization (Streaming deserialization APIs). This feature allows for items in a long list to be deserialized as they are streamed to the client from a server, rather than waiting for the entire request to be completed. So it will result in a perceived performance increase. Is there any chance for Progress to look into bringing support for this feature to Telerik Data Source Responses? I can anticipate the data field in the response class makes this a challenging ask. Also, the server-side needs to be able to return yield for async items. I am interested in seeing this feature implemented so the grids in my applications that have many items will begin to be usable sooner.
1 answer
95 views

Hi,

 

I am trying to implement a loading spinner with the <TelerikAutoComplete> control.

 

I have overriden the <NoDataTemplate>


<p>@IsLoading</p>
<TelerikAutoComplete
    @ref="@AutoCompleteControl"
    Data="ActiveDataSet"
    @bind-Value="SearchTerm"
    DebounceDelay="500"
    Placeholder="Search here..."
    FilterOperator="StringFilterOperator.Contains"
    ClearButton="true">
    <NoDataTemplate>
        @if (IsLoading)
        {
            <TelerikLoader Visible="true"
                           Size="@ThemeConstants.Loader.Size.Large"
                           ThemeColor="@ThemeConstants.Loader.ThemeColor.Tertiary"
                           Type="@LoaderType.ConvergingSpinner"/>
        }
        else
        {
            <p>No Data</p>
        }
    </NoDataTemplate>
</TelerikAutoComplete>
From the setter of SearchTerm I call 'Search'

where I'm getting the data and updating my 'IsLoading'

private async Task Search(string searchTerm)
{
    try
    {
        // Long running search that updates the data
    }
    finally
    {
        IsLoading = false;
        StateHasChanged();
        // AutoCompleteControl.Rebind(); // Without this the loading spinner never goes away
    }
    
}

If I don't include the AutoCompleteControl.Rebind(); the loading indicator never goes away, despite the Data being updated and IsLoading being set to false.

Is there something I'm missing about how to update the binding inside the <NoDataTemplate>?

Thanks!

Georgi
Telerik team
 answered on 24 Aug 2023
1 answer
65 views

I'm using a TelerikAutoComplete as a filter/searchbox for a Grid. I'm using the OnChange event to call a method that gets the filtered Grid data. It works great until the user clicks the (Add) button to add a new record. At this point, the OnChange event fires again because the OnChange also fires for the OnBlur. 

The effect is that the user clicks the Add button and they see the spinner in the TelerikLoaderContainer for a second or less, and then they have to click the button again to actually fire the event for the button.

I need to move focus away from the AutoComplete after the first OnChange fires, but FocusAsync() doesn't exist for a TelerikGrid or GridCommandButton.

Dimo
Telerik team
 answered on 01 Jun 2023
1 answer
138 views

Hello.

It's possible to hide No Data Template if, when typing, no value are found?

THanks

Louis
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 25 Mar 2023
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?