Hello, I've been working around with the Autocomplete component and I'm wondering if there's any way of discriminating specifically whenever the user presses the pop up button from the autocomplete control. (A callback or something else).
I'm asking, since I'm required to do some other logic when this button is pressed (showing a dialog and do other things). And I've managed to do it, up until a certain point, but the behavior breaks when entering a random set of characters and immediately pressing the search button, which defaults to showing the full Datasource dropdown. As more of a background, I've been using the Filtering event to set a flag that will let the filtering and the default popup show accordingly for that instance. But since the OnOpen listens both to the filtering and this button pressing it's getting mixed up somewhere in between.
Edit 1: The filtering I'm doing is not the default one, I'm filtering on 2 fields from the DataSource using this approach:
https://www.syncfusion.com/forums/164193/how-to-filter-on-more-than-one-data-field-in-blazor-autocomplete
Hi ICodeYes,
Based on your shared information we have validated the autocomplete component with enable the ShowPopupButton property. But we cannot replicate the reported issue on our end.
Find the sample code here:
<SfAutoComplete TValue="string" TItem="Country" Placeholder="e.g. Australia" @bind-Value="@AutoVal" DataSource="@Countries" ShowPopupButton="true"> <AutoCompleteFieldSettings Value="Name"></AutoCompleteFieldSettings> </SfAutoComplete>
@code {
public string AutoVal;
public class Country { public string Name { get; set; }
public string Code { get; set; } }
List<Country> Countries = new List<Country> { new Country() { Name = "Australia", Code = "AU" }, new Country() { Name = "Bermuda", Code = "BM" }, new Country() { Name = "Canada", Code = "CA" }, new Country() { Name = "Cameroon", Code = "CM" }, }; } |
Find the screenshot here:
|
Find the validated sample in the attachment:
If still you have faced the same issue or we misunderstood your requirement, then please replicate the reported issue on our attached sample and revert us with a detailed issue replication procedure with any image or video demonstration. These details will help us to provide an exact solution as earlier as possible.
Regards,
Sureshkumar P.
Hello,
Thanks for taking the time to look at my question. Sadly I cannot share my code base at the moment, luckily I found a way to get to where I need to, but it means expanding a little but further on what Syncfusion has currently, I'll just leave this thread open with the idea that a callback attribute for the popup button click event, in the AutoComplete component, might be a good idea for people that need to override the default behavior of simply showing all the items from the Datasource, at least that was my case.
Again, thank you a lot!
Hi ICodeYes,
Query: might be a good idea for people that need to override the default behavior of simply showing all the items from the Datasource, at least that was my case.
In our autocomplete component when open the component popup by using popup button without typing (searching the value) the input element. The popup showcases full datasource data. This is the default behavior of our component.
Find the screenshot here:
|
Please find the sample in the attachment:
If we misunderstood your requirement, please share your exact requirement with any video or image representation. These details will help us to provide an exact solution as earlier as possible.
Regards,
Sureshkumar P
Hello,
I've the same requirement: when the show popup button is clicked I need to perform a custom action and not opening the popup.
This can be implemented easly if the ShowPopupButton has its own OnClicked event where I can prevent the default behaviour of showing all the elements.
Thanks,
Andrea
Hi Andrea ,
To achieve this, we recommend utilizing the OnOpen event, which is triggered when the popup is opened. By canceling this event, you can prevent the default behavior of showing all the elements in the popup. This will allow you to execute your custom action without displaying the popup content.
To assist you further, we have prepared documentation and a sample that demonstrates how to utilize the OnOpen event for your specific scenario.
Documentation reference : https://blazor.syncfusion.com/documentation/autocomplete/events#onopen
Regards,
Mallesh
Attachment: DDLServer_ba00e57c.zip